Ensure consistent GL state when drawing screen textures

Fixes palettized wipes being broken under some common conditions
This commit is contained in:
Hannu Hanhi 2022-03-17 03:40:01 +02:00
parent 1fd9d38994
commit 978006bc97

View file

@ -3016,10 +3016,8 @@ EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD pol
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]); pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
if (surf) PreparePolygon(surf, NULL, surf ? polyflags : (PF_NoDepthTest));
PreparePolygon(surf, NULL, polyflags); if (!surf)
else
Shader_SetUniforms(NULL, NULL, NULL, NULL); // prepare shader, if it is enabled
pglColor4ubv(white); pglColor4ubv(white);
pglTexCoordPointer(2, GL_FLOAT, 0, fix); pglTexCoordPointer(2, GL_FLOAT, 0, fix);
@ -3226,6 +3224,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, int width, int height)
clearColour.red = clearColour.green = clearColour.blue = 0; clearColour.red = clearColour.green = clearColour.blue = 0;
clearColour.alpha = 1; clearColour.alpha = 1;
ClearBuffer(true, false, &clearColour); ClearBuffer(true, false, &clearColour);
SetBlend(PF_NoDepthTest);
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]); pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
pglColor4ubv(white); pglColor4ubv(white);