]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Tomaz's patch to ask the driver for a gl_texture_anisotropy limit, and apply that...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 12 May 2004 22:08:29 +0000 (22:08 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 12 May 2004 22:08:29 +0000 (22:08 +0000)
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
glquake.h
menu.c
vid_shared.c

index 0b03b0a4d020718dadec181f151cd255f3930e9f..bb90b83c89d94b48675e922acb76d0d2ecde1a02 100644 (file)
@@ -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
index 84107ce4d650b4aaa59671a43e21e5b44f0c8e6f..034b27dd910e3d895698028a6748004e51b7e85c 100644 (file)
--- 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 ba6abad5532d4956467d14b4d462e8090d937e82..c648333c63642d0e3b96332f1de9d14c1b4ab8b8 100644 (file)
--- 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);
index ae62bcbacaf1f2266cbd4bb65d6dbc0f2bac47c9..10c63a6d175fac596391450e32077ae2dd5c5eb8 100644 (file)
@@ -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);