GLSLGamma_GammaCorrect: clear the cached texture binding in GL_Bind properly, after the glBindTexture calls earlier in this function.

Fixes a obscure bug where:
 - a bsp with no textures (pink checkerboard displayed)
 - gamma != 1
 - nothing else on screen (sbar hidden, r_drawviewmodel 0)
would result in the screen turning to noise.

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1263 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
ewasylishen 2015-12-13 07:23:04 +00:00
parent a3705a9750
commit cfb7d1fdb2
3 changed files with 20 additions and 1 deletions

View File

@ -251,7 +251,7 @@ void GLSLGamma_GammaCorrect (void)
GL_UseProgramFunc (0); GL_UseProgramFunc (0);
// clear cached binding // clear cached binding
GL_Bind (notexture); GL_ClearBindings ();
} }
/* /*

View File

@ -1521,3 +1521,21 @@ static void GL_DeleteTexture (gltexture_t *texture)
texture->texnum = 0; texture->texnum = 0;
} }
/*
================
GL_ClearBindings -- ericw
Invalidates cached bindings, so the next GL_Bind calls for each TMU will
make real glBindTexture calls.
Call this after changing the binding outside of GL_Bind.
================
*/
void GL_ClearBindings(void)
{
int i;
for (i = 0; i < 3; i++)
{
currenttexture[i] = -1;
}
}

View File

@ -104,6 +104,7 @@ void GL_SelectTexture (GLenum target);
void GL_DisableMultitexture (void); //selects texture unit 0 void GL_DisableMultitexture (void); //selects texture unit 0
void GL_EnableMultitexture (void); //selects texture unit 1 void GL_EnableMultitexture (void); //selects texture unit 1
void GL_Bind (gltexture_t *texture); void GL_Bind (gltexture_t *texture);
void GL_ClearBindings (void);
#endif /* _GL_TEXMAN_H */ #endif /* _GL_TEXMAN_H */