diff --git a/quakespasm/Quake/gl_rmain.c b/quakespasm/Quake/gl_rmain.c index fad620b4..908425a6 100644 --- a/quakespasm/Quake/gl_rmain.c +++ b/quakespasm/Quake/gl_rmain.c @@ -251,7 +251,7 @@ void GLSLGamma_GammaCorrect (void) GL_UseProgramFunc (0); // clear cached binding - GL_Bind (notexture); + GL_ClearBindings (); } /* diff --git a/quakespasm/Quake/gl_texmgr.c b/quakespasm/Quake/gl_texmgr.c index c1fc9d3f..7a18d48b 100644 --- a/quakespasm/Quake/gl_texmgr.c +++ b/quakespasm/Quake/gl_texmgr.c @@ -1521,3 +1521,21 @@ static void GL_DeleteTexture (gltexture_t *texture) 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; + } +} diff --git a/quakespasm/Quake/gl_texmgr.h b/quakespasm/Quake/gl_texmgr.h index f772df30..6597b0cc 100644 --- a/quakespasm/Quake/gl_texmgr.h +++ b/quakespasm/Quake/gl_texmgr.h @@ -104,6 +104,7 @@ void GL_SelectTexture (GLenum target); void GL_DisableMultitexture (void); //selects texture unit 0 void GL_EnableMultitexture (void); //selects texture unit 1 void GL_Bind (gltexture_t *texture); +void GL_ClearBindings (void); #endif /* _GL_TEXMAN_H */