diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 804bd9a00..ccf64494a 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3228,6 +3228,14 @@ void GL_Framebuffer_Disable(void) } #endif +static const float defaultscreenVerts[12] = +{ + -1.0f, -1.0f, 1.0f, + -1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, + 1.0f, -1.0f, 1.0f +}; + INT32 GL_GetTextureUsed(void) { FTextureInfo *tmp = TexCacheHead; @@ -3259,7 +3267,10 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]) float float_x, float_y, float_nextx, float_nexty; float xfix, yfix; - const float blackBack[16] = + if (gl_enable_screen_textures != 2) + return; + + static const float blackBack[16] = { -16.0f, -16.0f, 6.0f, -16.0f, 16.0f, 6.0f, @@ -3267,9 +3278,6 @@ void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]) 16.0f, -16.0f, 6.0f }; - if (gl_enable_screen_textures != 2) - return; - // X/Y stretch fix for all resolutions(!) xfix = (float)screen_texsizew/((float)(screen_width/(float)(SCREENVERTS-1))); yfix = (float)screen_texsizeh/((float)(screen_height/(float)(SCREENVERTS-1))); @@ -3348,14 +3356,6 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags) float fix[8]; float xfix, yfix; - const float screenVerts[12] = - { - -1.0f, -1.0f, 1.0f, - -1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, - 1.0f, -1.0f, 1.0f - }; - if (gl_enable_screen_textures != 2) return; @@ -3380,7 +3380,7 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags) pglColor4ubv(white); pglTexCoordPointer(2, GL_FLOAT, 0, fix); - pglVertexPointer(3, GL_FLOAT, 0, screenVerts); + pglVertexPointer(3, GL_FLOAT, 0, defaultscreenVerts); pglDrawArrays(GL_TRIANGLE_FAN, 0, 4); tex_downloaded = screenTextures[tex]; @@ -3394,16 +3394,11 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd) INT32 fademaskdownloaded = tex_downloaded; // the fade mask that has been set - const float screenVerts[12] = - { - -1.0f, -1.0f, 1.0f, - -1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, - 1.0f, -1.0f, 1.0f - }; - float fix[8]; + if (!gl_enable_screen_textures) + return; + const float defaultST[8] = { 0.0f, 1.0f, @@ -3412,9 +3407,6 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd) 1.0f, 1.0f }; - if (!gl_enable_screen_textures) - return; - xfix = 1/((float)screen_texsizew/(float)screen_width); yfix = 1/((float)screen_texsizeh/(float)screen_height); @@ -3436,7 +3428,7 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd) pglBindTexture(GL_TEXTURE_2D, screenTextures[wipeStart]); pglColor4ubv(white); pglTexCoordPointer(2, GL_FLOAT, 0, fix); - pglVertexPointer(3, GL_FLOAT, 0, screenVerts); + pglVertexPointer(3, GL_FLOAT, 0, defaultscreenVerts); pglDrawArrays(GL_TRIANGLE_FAN, 0, 4); GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest); @@ -3455,7 +3447,7 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd) pglClientActiveTexture(GL_TEXTURE0); pglTexCoordPointer(2, GL_FLOAT, 0, fix); - pglVertexPointer(3, GL_FLOAT, 0, screenVerts); + pglVertexPointer(3, GL_FLOAT, 0, defaultscreenVerts); pglClientActiveTexture(GL_TEXTURE1); pglEnableClientState(GL_TEXTURE_COORD_ARRAY); pglTexCoordPointer(2, GL_FLOAT, 0, defaultST); @@ -3473,9 +3465,13 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 { float xfix, yfix; float fix[8]; - GLubyte color[4] = {255, 255, 255, 255}; float i; + if (gl_enable_screen_textures != 2) + return; + + GLubyte color[4] = {255, 255, 255, 255}; + float screenVerts[12] = { -1.0f, -1.0f, 1.0f, @@ -3484,9 +3480,6 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 1.0f, -1.0f, 1.0f }; - if (gl_enable_screen_textures != 2) - return; - xfix = 1/((float)screen_texsizew/(float)screen_width); yfix = 1/((float)screen_texsizeh/(float)screen_height); @@ -3611,8 +3604,8 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh float xoff = 1, yoff = 1; // xoffset and yoffset for the polygon to have black bars around the screen FRGBAFloat clearColour; - float off[12]; - float fix[8]; + static float off[12]; + static float fix[8]; if (gl_enable_screen_textures != 2) return;