-/* $Id: enable.c,v 1.19 2000/05/07 20:41:30 brianp Exp $ */
+/* $Id: enable.c,v 1.20 2000/05/22 16:33:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->Pixel.Separable2DEnabled = state;
break;
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+#if 0
+ if (ctx->Visual->RGBAflag) {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ const GLuint flag = TEXTURE0_CUBE << (curr * 4);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ ctx->NewState |= NEW_TEXTURE_ENABLE;
+ if (state) {
+ texUnit->Enabled |= TEXTURE0_2D;
+ ctx->Enabled |= flag;
+ }
+ else {
+ texUnit->Enabled &= ~TEXTURE0_2D;
+ ctx->Enabled &= ~flag;
+ }
+ }
+ break;
+#endif
+
default:
if (state) {
gl_error( ctx, GL_INVALID_ENUM, "glEnable" );
case GL_SEPARABLE_2D:
return ctx->Pixel.Separable2DEnabled;
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+#if 0
+ if (ctx->Visual->RGBAflag) {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ const GLuint flag = TEXTURE0_CUBE << (curr * 4);
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ ctx->NewState |= NEW_TEXTURE_ENABLE;
+ if (state) {
+ texUnit->Enabled |= TEXTURE0_2D;
+ ctx->Enabled |= flag;
+ }
+ else {
+ texUnit->Enabled &= ~TEXTURE0_2D;
+ ctx->Enabled &= ~flag;
+ }
+ }
+ break;
+#endif
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
return GL_FALSE;
-/* $Id: get.c,v 1.25 2000/05/07 23:18:54 brianp Exp $ */
+/* $Id: get.c,v 1.26 2000/05/22 16:33:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
*params = INT_TO_BOOL(ctx->Const.SubPixelBits);
break;
case GL_TEXTURE_1D:
- *params = _mesa_IsEnabled(GL_TEXTURE_1D );
+ *params = _mesa_IsEnabled(GL_TEXTURE_1D);
break;
case GL_TEXTURE_2D:
- *params = _mesa_IsEnabled(GL_TEXTURE_2D );
+ *params = _mesa_IsEnabled(GL_TEXTURE_2D);
break;
case GL_TEXTURE_3D:
- *params = _mesa_IsEnabled(GL_TEXTURE_3D );
+ *params = _mesa_IsEnabled(GL_TEXTURE_3D);
break;
case GL_TEXTURE_BINDING_1D:
*params = INT_TO_BOOL(textureUnit->CurrentD[1]->Name);
break;
case GL_TEXTURE_BINDING_3D:
*params = INT_TO_BOOL(textureUnit->CurrentD[3]->Name);
- break;
+ break;
case GL_TEXTURE_ENV_COLOR:
{
params[0] = FLOAT_TO_BOOL(textureUnit->EnvColor[0]);
*params = INT_TO_BOOL(ctx->Array.EdgeFlag.Stride);
break;
+ /* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
*params = ctx->Const.MaxTextureUnits;
break;
*params = INT_TO_BOOL(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);
break;
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = INT_TO_BOOL(textureUnit->CurrentPosX->Name);
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = INT_TO_BOOL(ctx->Const.MaxCubeTextureSize);
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ break;
+
/* GL_PGI_misc_hints */
case GL_STRICT_DEPTHFUNC_HINT_PGI:
*params = ENUM_TO_BOOL(GL_NICEST);
/* GL_ARB_transpose_matrix */
case GL_TRANSPOSE_COLOR_MATRIX_ARB:
- /* don't have a color matrix */
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->ColorMatrix.m);
+ for (i=0;i<16;i++) {
+ params[i] = FLOAT_TO_BOOL(tm[i]);
+ }
+ }
break;
case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
{
*params = 0.0;
break;
+ /* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
*params = (GLdouble) ctx->Const.MaxTextureUnits;
break;
*params = (GLdouble) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);
break;
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = (GLdouble) textureUnit->CurrentPosX->Name;
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = (GLdouble) ctx->Const.MaxCubeTextureSize;
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
/* GL_PGI_misc_hints */
case GL_STRICT_DEPTHFUNC_HINT_PGI:
/* GL_ARB_transpose_matrix */
case GL_TRANSPOSE_COLOR_MATRIX_ARB:
- /* don't have a color matrix */
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->ColorMatrix.m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLdouble) tm[i];
+ }
+ }
break;
case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
{
*params = 0.0;
break;
+ /* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
*params = (GLfloat) ctx->Const.MaxTextureUnits;
break;
*params = (GLfloat) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);
break;
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = (GLfloat) textureUnit->CurrentPosX->Name;
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = (GLfloat) ctx->Const.MaxCubeTextureSize;
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+
/* GL_PGI_misc_hints */
case GL_STRICT_DEPTHFUNC_HINT_PGI:
*params = ENUM_TO_FLOAT(GL_NICEST);
/* GL_ARB_transpose_matrix */
case GL_TRANSPOSE_COLOR_MATRIX_ARB:
- /* don't have a color matrix */
+ gl_matrix_transposef(params, ctx->ColorMatrix.m);
break;
case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
gl_matrix_transposef(params, ctx->ModelView.m);
*params = 0;
break;
+ /* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
*params = ctx->Const.MaxTextureUnits;
break;
*params = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture;
break;
+ /* GL_ARB_texture_cube_map */
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB);
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = textureUnit->CurrentPosX->Name;
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap)
+ *params = ctx->Const.MaxCubeTextureSize;
+ else
+ gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+
/* GL_PGI_misc_hints */
case GL_STRICT_DEPTHFUNC_HINT_PGI:
*params = (GL_NICEST);
/* GL_ARB_transpose_matrix */
case GL_TRANSPOSE_COLOR_MATRIX_ARB:
- /* don't have a color matrix */
+ {
+ GLfloat tm[16];
+ GLuint i;
+ gl_matrix_transposef(tm, ctx->ColorMatrix.m);
+ for (i=0;i<16;i++) {
+ params[i] = (GLint) tm[i];
+ }
+ }
break;
case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB:
{
}
+/*
+ * Given a texture unit and a texture target, return the corresponding
+ * texture object.
+ */
+static struct gl_texture_object *
+select_tex_object(struct gl_texture_unit *unit, GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_1D:
+ return unit->CurrentD[1];
+ case GL_TEXTURE_2D:
+ return unit->CurrentD[2];
+ case GL_TEXTURE_3D:
+ return unit->CurrentD[3];
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+ return unit->CurrentPosX;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+ return unit->CurrentNegX;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+ return unit->CurrentPosY;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+ return unit->CurrentNegY;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+ return unit->CurrentPosZ;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+ return unit->CurrentNegZ;
+ default:
+ gl_problem(NULL, "bad target in select_tex_object()");
+ return NULL;
+ }
+}
+
/*
* Return new gl_texture_image struct with all fields initialized to zero.
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[2];
+ texObj = select_tex_object(texUnit, target);
texImage = texObj->Image[level];
if (!texImage) {
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[2];
+ texObj = select_tex_object(texUnit, target);
texImage = texObj->Image[level];
assert(texImage);
-/* $Id: texstate.c,v 1.9 2000/03/07 17:54:58 brianp Exp $ */
+/* $Id: texstate.c,v 1.10 2000/05/22 16:33:21 brianp Exp $ */
/*
* Mesa 3-D graphics library
case GL_TEXTURE_3D_EXT:
texObj = texUnit->CurrentD[3];
break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap) {
+ texObj = texUnit->CurrentPosX;
+ break;
+ }
+ /* fallthrough */
default:
gl_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
return;
case GL_TEXTURE_3D:
img = texUnit->CurrentD[3]->Image[level];
dimensions = 3;
- break;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap) {
+ img = texUnit->CurrentPosX->Image[level];
+ dimensions = 2;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)");
+ return;
+ }
+ break;
case GL_PROXY_TEXTURE_1D:
img = ctx->Texture.Proxy1D->Image[level];
dimensions = 1;
img = ctx->Texture.Proxy3D->Image[level];
dimensions = 3;
break;
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ if (ctx->Extensions.HaveTextureCubeMap) {
+ img = ctx->Texture.ProxyCubeMap->Image[level];
+ dimensions = 2;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)");
+ return;
+ }
+ break;
default:
gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)");
return;