-/* $Id: enums.c,v 1.6 2000/02/05 01:52:05 brianp Exp $ */
+/* $Id: enums.c,v 1.7 2000/03/07 17:54:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
{ "GL_CLIENT_ACTIVE_TEXTURE_ARB", 0x84E1 },
{ "GL_MAX_TEXTURE_UNITS_ARB", 0x84E2 },
+ { "GL_TEXTURE_FILTER_CONTROL_EXT", 0x8500 },
+ { "GL_TEXTUER_LOD_BIAS_EXT", 0x8501 },
+
{ "GL_NORMAL_MAP_NV", 0x8511 },
{ "GL_REFLECTION_MAP_NV", 0x8512 },
-/* $Id: extensions.c,v 1.18 2000/02/25 03:55:40 keithw Exp $ */
+/* $Id: extensions.c,v 1.19 2000/03/07 17:54:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
struct extension {
struct extension *next, *prev;
- int enabled;
+ GLint enabled;
char name[MAX_EXT_NAMELEN+1];
void (*notify)( GLcontext *, GLboolean );
};
{ ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" },
{ DEFAULT_OFF, "GL_EXT_vertex_array_set" },
{ DEFAULT_OFF, "GL_EXT_texture_env" },
+ { DEFAULT_ON, "GL_EXT_texture_lod_bias" }
};
+/*
+ * Update the boolean convenience flags in the Extensions struct.
+ */
+static void
+update_extension_flags( GLcontext *ctx )
+{
+ /* Update flags */
+ ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add");
+ ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias");
+}
+
+
+
int gl_extensions_add( GLcontext *ctx,
int state,
const char *name,
}
-static int set_extension( GLcontext *ctx, const char *name, GLuint state )
+/*
+ * Either enable or disable the named extension.
+ */
+static int set_extension( GLcontext *ctx, const char *name, GLint state )
{
struct extension *i;
foreach( i, ctx->Extensions.ext_list )
if (strncmp(i->name, name, MAX_EXT_NAMELEN) == 0)
break;
- if (i == ctx->Extensions.ext_list) return 1;
+ if (i == ctx->Extensions.ext_list)
+ return 1;
- if (i->enabled && !(i->enabled & ALWAYS_ENABLED))
- {
+ if (i->enabled && !(i->enabled & ALWAYS_ENABLED)) {
if (i->notify) i->notify( ctx, state );
i->enabled = state;
}
+ update_extension_flags(ctx);
+
return 0;
}
default_extensions[i].name,
0 );
}
+ update_extension_flags(ctx);
}
-/* $Id: texstate.c,v 1.8 2000/03/07 17:11:29 brianp Exp $ */
+/* $Id: texstate.c,v 1.9 2000/03/07 17:54:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv");
- if (target!=GL_TEXTURE_ENV) {
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
- return;
- }
+ if (target==GL_TEXTURE_ENV) {
- if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n",
- gl_lookup_enum_by_nr(target),
- gl_lookup_enum_by_nr(pname),
- *param,
- gl_lookup_enum_by_nr((GLenum) (GLint) *param));
-
-
- if (pname==GL_TEXTURE_ENV_MODE) {
- GLenum mode = (GLenum) (GLint) *param;
- switch (mode) {
- case GL_ADD:
- if (!gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add")) {
- gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
- return;
- }
- /* FALL-THROUGH */
- case GL_MODULATE:
- case GL_BLEND:
- case GL_DECAL:
- case GL_REPLACE:
+ if (pname==GL_TEXTURE_ENV_MODE) {
+ GLenum mode = (GLenum) (GLint) *param;
+ switch (mode) {
+ case GL_ADD:
+ if (!ctx->Extensions.HaveTextureEnvAdd) {
+ gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
+ return;
+ }
+ /* FALL-THROUGH */
+ case GL_MODULATE:
+ case GL_BLEND:
+ case GL_DECAL:
+ case GL_REPLACE:
/* A small optimization for drivers */
if (texUnit->EnvMode == mode)
- return;
+ return;
if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_TEXTURE))
fprintf(stderr, "glTexEnv: old mode %s, new mode %s\n",
default:
gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
return;
+ }
+ }
+ else if (pname==GL_TEXTURE_ENV_COLOR) {
+ texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F );
+ texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F );
+ texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F );
+ texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F );
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
}
+
}
- else if (pname==GL_TEXTURE_ENV_COLOR) {
- texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F );
- texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F );
- texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F );
- texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F );
+ else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) {
+
+ if (!ctx->Extensions.HaveTextureLodBias) {
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ return;
+ }
+
+ if (pname==GL_TEXTURE_LOD_BIAS_EXT) {
+ texUnit->LodBias = param[0];
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
+ }
+
}
else {
- gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
return;
}
+ if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
+ fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n",
+ gl_lookup_enum_by_nr(target),
+ gl_lookup_enum_by_nr(pname),
+ *param,
+ gl_lookup_enum_by_nr((GLenum) (GLint) *param));
+
/* Tell device driver about the new texture environment */
if (ctx->Driver.TexEnv) {
(*ctx->Driver.TexEnv)( ctx, target, pname, param );
}
+
}