summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-11-06 15:53:00 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-11-06 15:53:00 +0000
commit87c964d3885d84959f86d5d7d9c4358240b6da3c (patch)
tree02eb6a543e71e371030f17e036bedf48089e2fe2
parent85e7d7c1d889f867762c6f62070729089f1877ac (diff)
added missing GL_MAX_TEXTURE_LOD_BIAS_EXT query
-rw-r--r--progs/demos/lodbias.c9
-rw-r--r--src/mesa/main/config.h5
-rw-r--r--src/mesa/main/context.c3
-rw-r--r--src/mesa/main/get.c22
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/texstate.c5
6 files changed, 40 insertions, 7 deletions
diff --git a/progs/demos/lodbias.c b/progs/demos/lodbias.c
index b2fab0b4eb..3533241be5 100644
--- a/progs/demos/lodbias.c
+++ b/progs/demos/lodbias.c
@@ -40,7 +40,7 @@
static GLfloat Xrot = 0, Yrot = -30, Zrot = 0;
static GLboolean Anim = GL_TRUE;
static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */
-static GLint BiasMin = -200, BiasMax = 500;
+static GLint BiasMin = -400, BiasMax = 400;
@@ -192,6 +192,8 @@ static void SpecialKey( int key, int x, int y )
static void Init( void )
{
const char *exten = (const char *) glGetString(GL_EXTENSIONS);
+ GLfloat maxBias;
+
if (!strstr(exten, "GL_EXT_texture_lod_bias")) {
printf("Sorry, GL_EXT_texture_lod_bias not supported by this renderer.\n");
exit(1);
@@ -207,6 +209,11 @@ static void Init( void )
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &maxBias);
+ printf("LOD bias range: [%g, %g]\n", -maxBias, maxBias);
+ BiasMin = -100 * maxBias;
+ BiasMax = 100 * maxBias;
}
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index fa65d611bd..6e1bde8512 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -1,4 +1,4 @@
-/* $Id: config.h,v 1.34 2001/07/16 15:54:23 brianp Exp $ */
+/* $Id: config.h,v 1.35 2001/11/06 15:53:00 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -134,6 +134,9 @@
/* GL_EXT_texture_filter_anisotropic */
#define MAX_TEXTURE_MAX_ANISOTROPY 16.0
+/* GL_EXT_texture_lod_bias */
+#define MAX_TEXTURE_LOD_BIAS 4.0
+
/*
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 690071fee9..230af9c564 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.148 2001/10/18 08:04:57 joukj Exp $ */
+/* $Id: context.c,v 1.149 2001/11/06 15:53:00 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -738,6 +738,7 @@ init_attrib_groups( GLcontext *ctx )
ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS;
ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY;
+ ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS;
ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE;
ctx->Const.SubPixelBits = SUB_PIXEL_BITS;
ctx->Const.MinPointSize = MIN_POINT_SIZE;
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 1588127622..b7f5d09b79 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.71 2001/10/25 23:21:28 brianp Exp $ */
+/* $Id: get.c,v 1.72 2001/11/06 15:53:00 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1258,6 +1258,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = INT_TO_BOOL(ctx->Array.FogCoord.Stride);
break;
+ /* GL_EXT_texture_lod_bias */
+ case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+ *params = FLOAT_TO_BOOL(ctx->Const.MaxTextureLodBias);
+ break;
+
/* GL_EXT_texture_filter_anisotropic */
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
@@ -2557,6 +2562,11 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Array.FogCoord.Stride;
break;
+ /* GL_EXT_texture_lod_bias */
+ case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+ *params = (GLdouble) ctx->Const.MaxTextureLodBias;
+ break;
+
/* GL_EXT_texture_filter_anisotropic */
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
@@ -3837,6 +3847,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Array.FogCoord.Stride;
break;
+ /* GL_EXT_texture_lod_bias */
+ case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+ *params = ctx->Const.MaxTextureLodBias;
+ break;
+
/* GL_EXT_texture_filter_anisotropic */
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
@@ -5159,6 +5174,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
}
break;
+ /* GL_EXT_texture_lod_bias */
+ case GL_MAX_TEXTURE_LOD_BIAS_EXT:
+ *params = (GLint) ctx->Const.MaxTextureLodBias;
+ break;
+
/* GL_EXT_texture_filter_anisotropic */
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c670e57413..b4853f64e6 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.51 2001/10/17 13:31:07 brianp Exp $ */
+/* $Id: mtypes.h,v 1.52 2001/11/06 15:53:00 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1165,6 +1165,7 @@ struct gl_constants {
GLint MaxCubeTextureLevels;
GLuint MaxTextureUnits;
GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */
+ GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */
GLuint MaxArrayLockSize;
GLint SubPixelBits;
GLfloat MinPointSize, MaxPointSize; /* aliased */
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index f2f0211606..06c3f81871 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.58 2001/10/17 13:31:07 brianp Exp $ */
+/* $Id: texstate.c,v 1.59 2001/11/06 15:53:00 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -413,7 +413,8 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
if (texUnit->LodBias == param[0])
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->LodBias = param[0];
+ texUnit->LodBias = CLAMP(param[0], -ctx->Const.MaxTextureLodBias,
+ ctx->Const.MaxTextureLodBias);
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);