From ea65ff0c6db6ef0abb416e95695f12f02d82f347 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 19 Feb 2015 00:50:54 +0000 Subject: [PATCH] gl_texmgr.c: fix GL_DeleteTexture not clearing deleted textures out of our currently-bound-texture cache for all TMU's Fixes a bug where if you do "map e1m6" then "kill", the fullbright part of the key texture is missing (drawn in black) - this bug was introduced in 0.90.0. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1168 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/gl_texmgr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Quake/gl_texmgr.c b/Quake/gl_texmgr.c index cc9b0580..f9c2bf97 100644 --- a/Quake/gl_texmgr.c +++ b/Quake/gl_texmgr.c @@ -1496,18 +1496,17 @@ void GL_Bind (gltexture_t *texture) ================ GL_DeleteTexture -- ericw -Wrapper around glDeleteTextures that also updates our cached current texture -binding, if necessary. +Wrapper around glDeleteTextures that also clears the given texture number +from our per-TMU cached texture binding table. ================ */ static void GL_DeleteTexture (gltexture_t *texture) { glDeleteTextures (1, &texture->texnum); - if (texture->texnum == currenttexture[currenttarget - GL_TEXTURE0_ARB]) - { - currenttexture[currenttarget - GL_TEXTURE0_ARB] = 0; - } + if (texture->texnum == currenttexture[0]) currenttexture[0] = -1; + if (texture->texnum == currenttexture[1]) currenttexture[1] = -1; + if (texture->texnum == currenttexture[2]) currenttexture[2] = -1; texture->texnum = 0; }