From f92ec7bb89e120ebcb92d17821997e5b15cd7b97 Mon Sep 17 00:00:00 2001 From: pogokeen Date: Sat, 25 May 2019 14:59:14 +0000 Subject: [PATCH] polymost.cpp: fix issue where GL_ALPHA_TEST could be enabled in certain instances when executing polymost_drawrooms() and better handle when we are drawing without a texture in polymost_drawpoly() git-svn-id: https://svn.eduke32.com/eduke32@7682 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/polymost.cpp --- source/build/src/polymost.cpp | 40 +++++++++++++---------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 00a1ac0a4..8584e4538 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -2264,12 +2264,6 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 if (!waloff[globalpicnum]) { tileLoad(globalpicnum); - - if (!waloff[globalpicnum]) - { - tsiz.x = tsiz.y = 1; - method = DAMETH_MASK; //Hack to update Z-buffer for invalid mirror textures - } } Bassert(n <= MAX_DRAWPOLY_VERTS); @@ -2335,6 +2329,12 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 return; } + if (!waloff[globalpicnum]) + { + tsiz.x = tsiz.y = 1; + glColorMask(false, false, false, false); //Hack to update Z-buffer for invalid mirror textures + } + static int32_t fullbright_pass = 0; if (pth->flags & PTH_HASFULLBRIGHT && r_fullbrights) @@ -2692,7 +2692,12 @@ do } if (videoGetRenderMode() != REND_POLYMOST) + { + if (!waloff[globalpicnum]) + glColorMask(true, true, true, true); + return; + } if (!(pth->flags & PTH_INDEXED)) { @@ -2732,6 +2737,9 @@ do xtex = bxtex, ytex = bytex, otex = botex; skyzbufferhack_pass--; } + + if (!waloff[globalpicnum]) + glColorMask(true, true, true, true); } @@ -5442,6 +5450,7 @@ void polymost_drawrooms() glClear(GL_DEPTH_BUFFER_BIT); glDisable(GL_BLEND); + glDisable(GL_ALPHA_TEST); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_ALWAYS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS // glDepthRange(0.0, 1.0); //<- this is more widely supported than glPolygonOffset @@ -5670,12 +5679,6 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) if ((uint32_t)globalpicnum >= MAXTILES) globalpicnum = 0; - if (!waloff[globalpicnum]) - { - glEnable(GL_BLEND); - glDisable(GL_ALPHA_TEST); - } - globalorientation = (int32_t)wal->cstat; DO_TILE_ANIM(globalpicnum, (int16_t)thewall[z]+16384); @@ -5866,19 +5869,6 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) polymost_updaterotmat(); polymost_drawpoly(dpxy, n, method); polymost_identityrotmat(); - - if (!waloff[globalpicnum]) - { - // restore this to normal - if (polymost_maskWallHasTranslucency(wal)) - { - glEnable(GL_ALPHA_TEST); - } else - { - glDisable(GL_BLEND); - glEnable(GL_ALPHA_TEST); - } - } } typedef struct