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;
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);
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;
}
-/* $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
/* GL_EXT_texture_filter_anisotropic */
#define MAX_TEXTURE_MAX_ANISOTROPY 16.0
+/* GL_EXT_texture_lod_bias */
+#define MAX_TEXTURE_LOD_BIAS 4.0
+
/*
-/* $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
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;
-/* $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
*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) {
*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) {
*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) {
}
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) {
-/* $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
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 */
-/* $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
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);