diff --git a/source/build/src/build.cpp b/source/build/src/build.cpp index 9b72842c9..e2e6ee44b 100644 --- a/source/build/src/build.cpp +++ b/source/build/src/build.cpp @@ -769,7 +769,7 @@ int app_main(int argc, char const * const * argv) g_videoBrightness = 0.0; videoSetPalette(0,0,0); - if (videoSetGameMode(fullscreen, xdim2d, ydim2d, bppgame) < 0) + if (videoSetGameMode(fullscreen, xdim2d, ydim2d, 8) < 0) { CallExtUnInit(); engineUnInit(); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index a36863970..c51ae5991 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -9825,6 +9825,14 @@ static void videoAllocateBuffers(void) ysavecnt = YSAVES; nodesperline = tabledivide32_noinline(YSAVES, ydim); + +#ifdef USE_OPENGL + extern char nogl; + if (videoGetRenderMode() == REND_CLASSIC && !nogl) + { + glsurface_initialize({xdim, ydim}); + } +#endif } #ifdef USE_OPENGL @@ -9899,11 +9907,6 @@ int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int32 #ifdef USE_OPENGL fxdim = (float) daxdim; fydim = (float) daydim; - - if (videoGetRenderMode() == REND_CLASSIC && !nogl) - { - glsurface_initialize({xdim, ydim}); - } #endif videoAllocateBuffers(); @@ -12759,21 +12762,21 @@ void videoSet2dMode(int32_t daxdim, int32_t daydim) ydim = yres; #ifdef USE_OPENGL - extern char nogl; - fxdim = (float) xres; fydim = (float) yres; - if (!nogl) - glsurface_initialize({ xres, yres }); + rendmode = REND_CLASSIC; #endif + videoAllocateBuffers(); ydim16 = yres - STATUS2DSIZ2; halfxdim16 = xres >> 1; midydim16 = ydim16 >> 1; // scale(200,yres,480); - videoClearScreen(0L); + videoBeginDrawing(); //{{{ + Bmemset((char *)frameplace, 0, yres*bytesperline); + videoEndDrawing(); //}}} } qsetmode = ((daxdim<<16)|(daydim&0xffff)); diff --git a/source/build/src/glsurface.cpp b/source/build/src/glsurface.cpp index 2a3d00340..4c861b0f0 100644 --- a/source/build/src/glsurface.cpp +++ b/source/build/src/glsurface.cpp @@ -85,6 +85,7 @@ bool glsurface_initialize(vec2_t inputBufferResolution) glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); + glActiveTexture(GL_TEXTURE0); glGenTextures(1, &bufferTexID); glBindTexture(GL_TEXTURE_2D, bufferTexID); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);