summaryrefslogtreecommitdiff
path: root/src/mesa/main/texstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/texstate.c')
-rw-r--r--src/mesa/main/texstate.c134
1 files changed, 133 insertions, 1 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 09bf872fe4..b9bb8f5f15 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.53 2001/06/13 14:56:14 brianp Exp $ */
+/* $Id: texstate.c,v 1.54 2001/06/18 17:26:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -2062,3 +2062,135 @@ _mesa_ClientActiveTextureARB( GLenum target )
FLUSH_VERTICES(ctx, _NEW_ARRAY);
ctx->Array.ActiveTexture = texUnit;
}
+
+
+
+/**********************************************************************/
+/* Pixel Texgen Extensions */
+/**********************************************************************/
+
+void
+_mesa_PixelTexGenSGIX(GLenum mode)
+{
+ GLenum newRgbSource, newAlphaSource;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (mode) {
+ case GL_NONE:
+ newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ break;
+ case GL_ALPHA:
+ newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ newAlphaSource = GL_CURRENT_RASTER_COLOR;
+ break;
+ case GL_RGB:
+ newRgbSource = GL_CURRENT_RASTER_COLOR;
+ newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS;
+ break;
+ case GL_RGBA:
+ newRgbSource = GL_CURRENT_RASTER_COLOR;
+ newAlphaSource = GL_CURRENT_RASTER_COLOR;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenSGIX(mode)");
+ return;
+ }
+
+ if (newRgbSource == ctx->Pixel.FragmentRgbSource &&
+ newAlphaSource == ctx->Pixel.FragmentAlphaSource)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.FragmentRgbSource = newRgbSource;
+ ctx->Pixel.FragmentAlphaSource = newAlphaSource;
+}
+
+
+void
+_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value)
+{
+ _mesa_PixelTexGenParameteriSGIS(target, (GLint) value);
+}
+
+
+void
+_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value)
+{
+ _mesa_PixelTexGenParameteriSGIS(target, (GLint) *value);
+}
+
+
+void
+_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (value != GL_CURRENT_RASTER_COLOR && value != GL_PIXEL_GROUP_COLOR_SGIS) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(value)");
+ return;
+ }
+
+ switch (target) {
+ case GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS:
+ if (ctx->Pixel.FragmentRgbSource == (GLenum) value)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.FragmentRgbSource = (GLenum) value;
+ break;
+ case GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS:
+ if (ctx->Pixel.FragmentAlphaSource == (GLenum) value)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PIXEL);
+ ctx->Pixel.FragmentAlphaSource = (GLenum) value;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(target)");
+ return;
+ }
+}
+
+
+void
+_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value)
+{
+ _mesa_PixelTexGenParameteriSGIS(target, *value);
+}
+
+
+void
+_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) {
+ *value = (GLfloat) ctx->Pixel.FragmentRgbSource;
+ }
+ else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) {
+ *value = (GLfloat) ctx->Pixel.FragmentAlphaSource;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterfvSGIS(target)");
+ }
+}
+
+
+void
+_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) {
+ *value = (GLint) ctx->Pixel.FragmentRgbSource;
+ }
+ else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) {
+ *value = (GLint) ctx->Pixel.FragmentAlphaSource;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterivSGIS(target)");
+ }
+}