From 1b8e0671211505551c07141101a7638eff62198b Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 12 May 2004 22:08:29 +0000 Subject: [PATCH] Tomaz's patch to ask the driver for a gl_texture_anisotropy limit, and apply that limit also fixed a bunch of extension variables that were not being reset on resolution changes git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4148 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 2 +- glquake.h | 1 + menu.c | 4 ++-- vid_shared.c | 20 ++++++++++++++++---- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/gl_textures.c b/gl_textures.c index 0b03b0a4..bb90b83c 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -572,7 +572,7 @@ static void GL_SetupTextureParameters(int flags, int texturetype) if (gl_support_anisotropy) { - int aniso = bound(1, gl_texture_anisotropy.integer, 128); + int aniso = bound(1, gl_texture_anisotropy.integer, gl_max_anisotropy); if (gl_texture_anisotropy.integer != aniso) Cvar_SetValueQuick(&gl_texture_anisotropy, aniso); qglTexParameteri(textureenum, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso);CHECKGLERROR diff --git a/glquake.h b/glquake.h index 84107ce4..034b27dd 100644 --- a/glquake.h +++ b/glquake.h @@ -121,6 +121,7 @@ typedef double GLclampd; #define GL_LINEAR_MIPMAP_LINEAR 0x2703 extern int gl_support_anisotropy; +extern int gl_max_anisotropy; #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF diff --git a/menu.c b/menu.c index ba6abad5..c648333c 100644 --- a/menu.c +++ b/menu.c @@ -1216,7 +1216,7 @@ void M_Menu_Options_AdjustSliders (int dir) else if (options_cursor == optnum++) Cvar_SetValueQuick (&gl_delayfinish, !gl_delayfinish.integer); else if (options_cursor == optnum++) - Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.value + dir, 8)); + Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.integer + dir, gl_max_anisotropy)); else if (options_cursor == optnum++) Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5)); else if (options_cursor == optnum++) @@ -1337,7 +1337,7 @@ void M_Options_Draw (void) M_Options_PrintCheckbox(" Texture Combine", true, gl_combine.integer); M_Options_PrintCheckbox(" Dithering", true, gl_dither.integer); M_Options_PrintCheckbox("Delay gfx (faster)", true, gl_delayfinish.integer); - M_Options_PrintSlider( "Anisotropic Filter", gl_support_anisotropy, gl_texture_anisotropy.value, 1, 8); + M_Options_PrintSlider( "Anisotropic Filter", gl_support_anisotropy, gl_texture_anisotropy.integer, 1, gl_max_anisotropy); M_Options_PrintSlider( " Game Speed", sv.active, slowmo.value, 0, 5); M_Options_PrintSlider( " CD Music Volume", cdaudioinitialized.integer, bgmvolume.value, 0, 1); M_Options_PrintSlider( " Sound Volume", snd_initialized.integer, volume.value, 0, 1); diff --git a/vid_shared.c b/vid_shared.c index ae62bcba..10c63a6d 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -15,7 +15,7 @@ qboolean in_client_mouse = true; float in_mouse_x, in_mouse_y; // GL_ARB_multitexture -int gl_textureunits = 0; +int gl_textureunits = 1; // GL_ARB_texture_env_combine or GL_EXT_texture_env_combine int gl_combine_extension = false; // GL_EXT_compiled_vertex_array @@ -38,6 +38,7 @@ int gl_support_var = false; int gl_support_var2 = false; // GL_EXT_texture_filter_anisotropic int gl_support_anisotropy = false; +int gl_max_anisotropy = 1; // GL_NV_texture_shader int gl_textureshader = false; // GL_EXT_stencil_two_side @@ -429,13 +430,23 @@ static dllfunction_t stenciltwosidefuncs[] = void VID_CheckExtensions(void) { gl_stencil = vid_bitsperpixel.integer == 32; + + // reset all the gl extension variables here + // this should match the declarations + gl_textureunits = 1; gl_combine_extension = false; - gl_dot3arb = false; gl_supportslockarrays = false; - gl_textureunits = 1; + gl_videosyncavailable = false; + gl_stencil = false; + gl_texture3d = false; + gl_texturecubemap = false; + gl_dot3arb = false; gl_support_clamptoedge = false; gl_support_var = false; gl_support_var2 = false; + gl_support_anisotropy = false; + gl_max_anisotropy = 1; + gl_textureshader = false; gl_support_stenciltwoside = false; if (!GL_CheckExtension("OpenGL 1.1.0", opengl110funcs, NULL, false)) @@ -472,7 +483,8 @@ void VID_CheckExtensions(void) if (gl_support_var) gl_support_var2 = GL_CheckExtension("GL_NV_vertex_array_range2", NULL, "-novar2", false); - gl_support_anisotropy = GL_CheckExtension("GL_EXT_texture_filter_anisotropic", NULL, "-noanisotropy", false); + if ((gl_support_anisotropy = GL_CheckExtension("GL_EXT_texture_filter_anisotropic", NULL, "-noanisotropy", false))) + qglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max_anisotropy); gl_textureshader = GL_CheckExtension("GL_NV_texture_shader", NULL, "-notextureshader", false); -- 2.39.2