TINYGL: Split/move functions to API and internal implementation.

This commit is contained in:
Paweł Kołodziejski 2022-01-01 14:06:10 +01:00
parent f1812277d2
commit 04b13dc61a
11 changed files with 324 additions and 273 deletions

View file

@ -145,7 +145,21 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
color_material_enabled = 0;
// textures
glInitTextures();
texture_2d_enabled = false;
current_texture = alloc_texture(0);
maxTextureName = 0;
texture_mag_filter = TGL_LINEAR;
texture_min_filter = TGL_NEAREST_MIPMAP_LINEAR;
#if defined(SCUMM_LITTLE_ENDIAN)
colorAssociationList.push_back({Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24), TGL_RGBA, TGL_UNSIGNED_BYTE});
colorAssociationList.push_back({Graphics::PixelFormat(3, 8, 8, 8, 0, 0, 8, 16, 0), TGL_RGB, TGL_UNSIGNED_BYTE});
#else
colorAssociationList.push_back({Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0), TGL_RGBA, TGL_UNSIGNED_BYTE});
colorAssociationList.push_back({Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0), TGL_RGB, TGL_UNSIGNED_BYTE});
#endif
colorAssociationList.push_back({Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), TGL_RGB, TGL_UNSIGNED_SHORT_5_6_5});
colorAssociationList.push_back({Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0), TGL_RGBA, TGL_UNSIGNED_SHORT_5_5_5_1});
colorAssociationList.push_back({Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0), TGL_RGBA, TGL_UNSIGNED_SHORT_4_4_4_4});
// default state
current_color = Vector4(1.0f, 1.0f, 1.0f, 1.0f);
@ -249,6 +263,10 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
TinyGL::Internal::tglBlitResetScissorRect();
}
GLContext *gl_get_context() {
return gl_ctx;
}
void destroyContext() {
GLContext *c = gl_get_context();
assert(c);