From: havoc Date: Sun, 13 Jul 2003 10:22:32 +0000 (+0000) Subject: GL_EXT_texture_filter_anisotropic support (thanks zinx!) X-Git-Tag: xonotic-v0.1.0preview~6536 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e8f39600b2eae0a57c6ef7a9ba1b90840e85a118;p=xonotic%2Fdarkplaces.git GL_EXT_texture_filter_anisotropic support (thanks zinx!) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3265 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_textures.c b/gl_textures.c index e1ccf153..bcfc554f 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -8,6 +8,7 @@ cvar_t r_max_scrapsize = {CVAR_SAVE, "r_max_scrapsize", "256"}; cvar_t r_picmip = {CVAR_SAVE, "r_picmip", "0"}; cvar_t r_lerpimages = {CVAR_SAVE, "r_lerpimages", "1"}; cvar_t r_precachetextures = {CVAR_SAVE, "r_precachetextures", "1"}; +cvar_t gl_texture_anisotropy = {CVAR_SAVE, "gl_texture_anisotropy", "0"}; int gl_filter_min = GL_LINEAR_MIPMAP_LINEAR; int gl_filter_mag = GL_LINEAR; @@ -519,6 +520,7 @@ void R_Textures_Init (void) Cvar_RegisterVariable (&r_picmip); Cvar_RegisterVariable (&r_lerpimages); Cvar_RegisterVariable (&r_precachetextures); + Cvar_RegisterVariable (&gl_texture_anisotropy); R_RegisterModule("R_Textures", r_textures_start, r_textures_shutdown, r_textures_newmap); } @@ -565,6 +567,8 @@ static void GL_SetupTextureParameters(int flags, int texturetype) CHECKGLERROR + if (gl_support_anisotropy) + qglTexParameterf(textureenum, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_anisotropy.value); qglTexParameteri(textureenum, GL_TEXTURE_WRAP_S, wrapmode); qglTexParameteri(textureenum, GL_TEXTURE_WRAP_T, wrapmode); if (gltexturetypedimensions[texturetype] >= 3) diff --git a/glquake.h b/glquake.h index 69542c0e..d6be002f 100644 --- a/glquake.h +++ b/glquake.h @@ -121,6 +121,10 @@ typedef double GLclampd; #define GL_LINEAR_MIPMAP_NEAREST 0x2701 #define GL_LINEAR_MIPMAP_LINEAR 0x2703 +extern int gl_support_anisotropy; +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF + #define GL_DECAL 0x2101 #define GL_MODULATE 0x2100 @@ -444,7 +448,7 @@ extern void (GLAPIENTRY *qglClearStencil)(GLint s); //extern void (GLAPIENTRY *qglTexEnvf)(GLenum target, GLenum pname, GLfloat param); extern void (GLAPIENTRY *qglTexEnvi)(GLenum target, GLenum pname, GLint param); -//extern void (GLAPIENTRY *qglTexParameterf)(GLenum target, GLenum pname, GLfloat param); +extern void (GLAPIENTRY *qglTexParameterf)(GLenum target, GLenum pname, GLfloat param); //extern void (GLAPIENTRY *qglTexParameterfv)(GLenum target, GLenum pname, GLfloat *params); extern void (GLAPIENTRY *qglTexParameteri)(GLenum target, GLenum pname, GLint param); diff --git a/vid_shared.c b/vid_shared.c index 8dd32054..76d3c75b 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -30,6 +30,8 @@ int gl_support_clamptoedge = false; int gl_support_var = false; // GL_NV_vertex_array_range2 int gl_support_var2 = false; +// GL_EXT_texture_filter_anisotropic +int gl_support_anisotropy = false; // LordHavoc: if window is hidden, don't update screen int vid_hidden = true; @@ -188,7 +190,7 @@ void (GLAPIENTRY *qglClearStencil)(GLint s); //void (GLAPIENTRY *qglTexEnvf)(GLenum target, GLenum pname, GLfloat param); void (GLAPIENTRY *qglTexEnvi)(GLenum target, GLenum pname, GLint param); -//void (GLAPIENTRY *qglTexParameterf)(GLenum target, GLenum pname, GLfloat param); +void (GLAPIENTRY *qglTexParameterf)(GLenum target, GLenum pname, GLfloat param); //void (GLAPIENTRY *qglTexParameterfv)(GLenum target, GLenum pname, GLfloat *params); void (GLAPIENTRY *qglTexParameteri)(GLenum target, GLenum pname, GLint param); @@ -328,7 +330,7 @@ static dllfunction_t opengl110funcs[] = {"glClearStencil", (void **) &qglClearStencil}, // {"glTexEnvf", (void **) &qglTexEnvf}, {"glTexEnvi", (void **) &qglTexEnvi}, -// {"glTexParameterf", (void **) &qglTexParameterf}, + {"glTexParameterf", (void **) &qglTexParameterf}, // {"glTexParameterfv", (void **) &qglTexParameterfv}, {"glTexParameteri", (void **) &qglTexParameteri}, // {"glPixelStoref", (void **) &qglPixelStoref}, @@ -452,6 +454,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); + // we don't care if it's an extension or not, they are identical functions, so keep it simple in the rendering code if (qglDrawRangeElements == NULL) qglDrawRangeElements = qglDrawRangeElementsEXT;