aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-01-21 21:47:45 +0000
committerBrian Paul <[email protected]>2003-01-21 21:47:45 +0000
commit418ac00e7583bf3136816a43b3357e0d0b0c776d (patch)
tree4e75fbf211fff0700c85f2f69d75e0b535ba1efb /src/mesa/main
parent068a4812fc1d9e321aa65a91ceb8bc824bedc69a (diff)
GL_SGI_texture_color_table extension (Eric Plante)
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/colortab.c143
-rw-r--r--src/mesa/main/context.c8
-rw-r--r--src/mesa/main/dlist.c8
-rw-r--r--src/mesa/main/enable.c9
-rw-r--r--src/mesa/main/extensions.c4
-rw-r--r--src/mesa/main/get.c25
-rw-r--r--src/mesa/main/mtypes.h9
7 files changed, 189 insertions, 17 deletions
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index fb5c94259dd..04625c6c826 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -1,10 +1,10 @@
-/* $Id: colortab.c,v 1.46 2002/10/24 23:57:19 brianp Exp $ */
+/* $Id: colortab.c,v 1.47 2003/01/21 21:47:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -257,6 +257,30 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
table = &ctx->ProxyColorTable;
proxy = GL_TRUE;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ floatTable = GL_TRUE;
+ rScale = ctx->Texture.ColorTableScale[0];
+ gScale = ctx->Texture.ColorTableScale[1];
+ bScale = ctx->Texture.ColorTableScale[2];
+ aScale = ctx->Texture.ColorTableScale[3];
+ rBias = ctx->Texture.ColorTableBias[0];
+ gBias = ctx->Texture.ColorTableBias[1];
+ bBias = ctx->Texture.ColorTableBias[2];
+ aBias = ctx->Texture.ColorTableBias[3];
+ break;
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
+ return;
+ }
+ table = &ctx->ProxyTextureColorTable;
+ proxy = GL_TRUE;
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
floatTable = GL_TRUE;
@@ -486,6 +510,21 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
bBias = ctx->Pixel.ColorTableBias[2];
aBias = ctx->Pixel.ColorTableBias[3];
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ rScale = ctx->Texture.ColorTableScale[0];
+ gScale = ctx->Texture.ColorTableScale[1];
+ bScale = ctx->Texture.ColorTableScale[2];
+ aScale = ctx->Texture.ColorTableScale[3];
+ rBias = ctx->Texture.ColorTableBias[0];
+ gBias = ctx->Texture.ColorTableBias[1];
+ bBias = ctx->Texture.ColorTableBias[2];
+ aBias = ctx->Texture.ColorTableBias[3];
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
rScale = ctx->Pixel.PCCTscale[0];
@@ -683,6 +722,13 @@ _mesa_GetColorTable( GLenum target, GLenum format,
case GL_COLOR_TABLE:
table = &ctx->ColorTable;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
break;
@@ -865,6 +911,28 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
return;
}
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)");
+ return;
+ }
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ ctx->Texture.ColorTableScale[0] = params[0];
+ ctx->Texture.ColorTableScale[1] = params[1];
+ ctx->Texture.ColorTableScale[2] = params[2];
+ ctx->Texture.ColorTableScale[3] = params[3];
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ ctx->Texture.ColorTableBias[0] = params[0];
+ ctx->Texture.ColorTableBias[1] = params[1];
+ ctx->Texture.ColorTableBias[2] = params[2];
+ ctx->Texture.ColorTableBias[3] = params[3];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
+ return;
+ }
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
ctx->Pixel.PCCTscale[0] = params[0];
@@ -916,6 +984,7 @@ _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
{
GLfloat fparams[4];
if (pname == GL_COLOR_TABLE_SGI ||
+ pname == GL_TEXTURE_COLOR_TABLE_SGI ||
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) {
/* four values */
@@ -999,6 +1068,34 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
case GL_PROXY_COLOR_TABLE:
table = &ctx->ProxyColorTable;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = ctx->Texture.ColorTableScale[0];
+ params[1] = ctx->Texture.ColorTableScale[1];
+ params[2] = ctx->Texture.ColorTableScale[2];
+ params[3] = ctx->Texture.ColorTableScale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = ctx->Texture.ColorTableBias[0];
+ params[1] = ctx->Texture.ColorTableBias[1];
+ params[2] = ctx->Texture.ColorTableBias[2];
+ params[3] = ctx->Texture.ColorTableBias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &ctx->ProxyTextureColorTable;
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
@@ -1054,22 +1151,22 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
*params = (GLfloat) table->Size;
break;
case GL_COLOR_TABLE_RED_SIZE:
- *params = table->RedSize;
+ *params = (GLfloat) table->RedSize;
break;
case GL_COLOR_TABLE_GREEN_SIZE:
- *params = table->GreenSize;
+ *params = (GLfloat) table->GreenSize;
break;
case GL_COLOR_TABLE_BLUE_SIZE:
- *params = table->BlueSize;
+ *params = (GLfloat) table->BlueSize;
break;
case GL_COLOR_TABLE_ALPHA_SIZE:
- *params = table->AlphaSize;
+ *params = (GLfloat) table->AlphaSize;
break;
case GL_COLOR_TABLE_LUMINANCE_SIZE:
- *params = table->LuminanceSize;
+ *params = (GLfloat) table->LuminanceSize;
break;
case GL_COLOR_TABLE_INTENSITY_SIZE:
- *params = table->IntensitySize;
+ *params = (GLfloat) table->IntensitySize;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" );
@@ -1145,6 +1242,34 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
case GL_PROXY_COLOR_TABLE:
table = &ctx->ProxyColorTable;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = (GLint) ctx->Texture.ColorTableScale[0];
+ params[1] = (GLint) ctx->Texture.ColorTableScale[1];
+ params[2] = (GLint) ctx->Texture.ColorTableScale[2];
+ params[3] = (GLint) ctx->Texture.ColorTableScale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = (GLint) ctx->Texture.ColorTableBias[0];
+ params[1] = (GLint) ctx->Texture.ColorTableBias[1];
+ params[2] = (GLint) ctx->Texture.ColorTableBias[2];
+ params[3] = (GLint) ctx->Texture.ColorTableBias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &ctx->ProxyTextureColorTable;
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 2d43652c8a7..9dac955c8a7 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.191 2003/01/14 04:55:45 brianp Exp $ */
+/* $Id: context.c,v 1.192 2003/01/21 21:47:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1323,6 +1323,9 @@ init_attrib_groups( GLcontext *ctx )
init_texture_unit( ctx, i );
ctx->Texture.SharedPalette = GL_FALSE;
_mesa_init_colortable(&ctx->Texture.Palette);
+ ASSIGN_4V(ctx->Texture.ColorTableScale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Texture.ColorTableBias, 0.0, 0.0, 0.0, 0.0);
+ ctx->Texture.ColorTableEnabled = GL_FALSE;
/* Transformation group */
ctx->Transform.MatrixMode = GL_MODELVIEW;
@@ -1462,6 +1465,8 @@ init_attrib_groups( GLcontext *ctx )
_mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable);
_mesa_init_colortable(&ctx->PostColorMatrixColorTable);
_mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable);
+ _mesa_init_colortable(&ctx->TextureColorTable);
+ _mesa_init_colortable(&ctx->ProxyTextureColorTable);
/* Vertex/fragment programs */
ctx->Program.ErrorPos = -1;
@@ -2035,6 +2040,7 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_free_colortable_data( &ctx->PostConvolutionColorTable );
_mesa_free_colortable_data( &ctx->PostColorMatrixColorTable );
_mesa_free_colortable_data( &ctx->Texture.Palette );
+ _mesa_free_colortable_data( &ctx->TextureColorTable );
_math_matrix_dtr(&ctx->Viewport._WindowMap);
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 2fcfb4a7034..f04bedc68e8 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1,4 +1,4 @@
-/* $Id: dlist.c,v 1.101 2003/01/14 04:55:45 brianp Exp $ */
+/* $Id: dlist.c,v 1.102 2003/01/21 21:47:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1141,7 +1141,8 @@ save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
n[3].f = params[0];
if (pname == GL_COLOR_TABLE_SGI ||
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) {
+ pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI ||
+ pname == GL_TEXTURE_COLOR_TABLE_SGI) {
n[4].f = params[1];
n[5].f = params[2];
n[6].f = params[3];
@@ -1169,7 +1170,8 @@ save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
n[3].i = params[0];
if (pname == GL_COLOR_TABLE_SGI ||
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) {
+ pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI ||
+ pname == GL_TEXTURE_COLOR_TABLE_SGI) {
n[4].i = params[1];
n[5].i = params[2];
n[6].i = params[3];
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 84d03112160..44c1e14015f 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.72 2003/01/14 04:55:45 brianp Exp $ */
+/* $Id: enable.c,v 1.73 2003/01/21 21:47:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -691,6 +691,13 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixColorTableEnabled = state;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_texture_color_table, cap);
+ if (ctx->Texture.ColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.ColorTableEnabled = state;
+ break;
/* GL_EXT_convolution */
case GL_CONVOLUTION_1D:
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 296308c4370..7e1f2038723 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.87 2003/01/21 15:49:14 brianp Exp $ */
+/* $Id: extensions.c,v 1.88 2003/01/21 21:47:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -122,6 +122,7 @@ static struct {
{ OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) },
{ OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) },
{ OFF, "GL_SGI_color_table", F(SGI_color_table) },
+ { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) },
{ OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) },
{ OFF, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) },
{ OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) },
@@ -199,6 +200,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
#endif
"GL_SGI_color_matrix",
"GL_SGI_color_table",
+ "GL_SGI_texture_color_table",
"GL_SGIS_generate_mipmap",
"GL_SGIS_pixel_texture",
"GL_SGIS_texture_edge_clamp",
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 8eac97fb5d5..9541ab00fc8 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.102 2003/01/21 15:45:39 brianp Exp $ */
+/* $Id: get.c,v 1.103 2003/01/21 21:47:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1229,6 +1229,12 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_B(SGI_texture_color_table, pname);
+ *params = ctx->Texture.ColorTableEnabled;
+ break;
+
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
CHECK_EXTENSION_B(EXT_secondary_color, pname);
@@ -2621,6 +2627,12 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_D(SGI_texture_color_table, pname);
+ *params = (GLdouble) ctx->Texture.ColorTableEnabled;
+ break;
+
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
CHECK_EXTENSION_D(EXT_secondary_color, pname);
@@ -3987,6 +3999,12 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_F(SGI_texture_color_table, pname);
+ *params = (GLfloat) ctx->Texture.ColorTableEnabled;
+ break;
+
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
CHECK_EXTENSION_F(EXT_secondary_color, pname);
@@ -5391,6 +5409,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_I(SGI_texture_color_table, pname);
+ *params = (GLint) ctx->Texture.ColorTableEnabled;
+ break;
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 353dc0d471b..37268c2afc2 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.99 2003/01/21 15:49:15 brianp Exp $ */
+/* $Id: mtypes.h,v 1.100 2003/01/21 21:47:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -975,6 +975,10 @@ struct gl_texture_attrib {
/* GL_EXT_shared_texture_palette */
GLboolean SharedPalette;
struct gl_color_table Palette;
+ /* GL_SGI_texture_color_table */
+ GLfloat ColorTableScale[4];
+ GLfloat ColorTableBias[4];
+ GLboolean ColorTableEnabled;
};
@@ -1395,6 +1399,7 @@ struct gl_extensions {
GLboolean NV_vertex_program1_1;
GLboolean SGI_color_matrix;
GLboolean SGI_color_table;
+ GLboolean SGI_texture_color_table;
GLboolean SGIS_generate_mipmap;
GLboolean SGIS_pixel_texture;
GLboolean SGIS_texture_edge_clamp;
@@ -1715,6 +1720,8 @@ struct __GLcontextRec {
struct gl_color_table ProxyPostConvolutionColorTable;
struct gl_color_table PostColorMatrixColorTable;
struct gl_color_table ProxyPostColorMatrixColorTable;
+ struct gl_color_table TextureColorTable;
+ struct gl_color_table ProxyTextureColorTable;
struct program_state Program; /* for vertex or fragment progs */
struct vertex_program_state VertexProgram; /* GL_NV_vertex_program */