From 56cca7e199333b3c8e9325e72f9c23840efa4790 Mon Sep 17 00:00:00 2001 From: tomaz Date: Sat, 17 Jul 2004 20:15:25 +0000 Subject: [PATCH] made gl_texture_anisotropy take effect immediately like gl_texturemode rather than needing an r_restart git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4275 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/gl_textures.c b/gl_textures.c index 9b1181ec..1ada32e4 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -530,6 +530,8 @@ void R_Textures_Init (void) void R_Textures_Frame (void) { + static old_aniso = 0; + // could do procedural texture animation here, if we keep track of which // textures were accessed this frame... @@ -545,6 +547,34 @@ void R_Textures_Frame (void) Mem_Free(colorconvertbuffer); colorconvertbuffer = NULL; } + + if (old_aniso != gl_texture_anisotropy.integer) + { + gltextureimage_t *image; + gltexturepool_t *pool; + GLint oldbindtexnum; + + old_aniso = bound(1, gl_texture_anisotropy.integer, gl_max_anisotropy); + + Cvar_SetValueQuick(&gl_texture_anisotropy, old_aniso); + + for (pool = gltexturepoolchain;pool;pool = pool->next) + { + for (image = pool->imagechain;image;image = image->imagechain) + { + // only update already uploaded images + if (!(image->flags & GLTEXF_UPLOAD)) + { + qglGetIntegerv(gltexturetypebindingenums[image->texturetype], &oldbindtexnum); + + qglBindTexture(gltexturetypeenums[image->texturetype], image->texnum); + qglTexParameteri(gltexturetypeenums[image->texturetype], GL_TEXTURE_MAX_ANISOTROPY_EXT, old_aniso);CHECKGLERROR + + qglBindTexture(gltexturetypeenums[image->texturetype], oldbindtexnum); + } + } + } + } } void R_MakeResizeBufferBigger(int size) -- 2.39.2