diff options
author | Brian Paul <[email protected]> | 2000-04-07 16:27:26 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-04-07 16:27:26 +0000 |
commit | 2b2e925ea4a5652b0ab73b1efbce345a42663842 (patch) | |
tree | 9824128cf7662c51830bd3b5a0b74721a071a881 /src/mesa/main | |
parent | ede4887b1650b18b3a2db3f175fcc33826bbab4d (diff) |
added GL_SGIX/SGIS_pixel_texture extension
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/attrib.c | 6 | ||||
-rw-r--r-- | src/mesa/main/context.c | 7 | ||||
-rw-r--r-- | src/mesa/main/drawpix.c | 16 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 22 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 6 | ||||
-rw-r--r-- | src/mesa/main/get.c | 76 | ||||
-rw-r--r-- | src/mesa/main/state.c | 14 |
7 files changed, 139 insertions, 8 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 617a274e03e..8e9966bca67 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.20 2000/03/19 01:10:11 brianp Exp $ */ +/* $Id: attrib.c,v 1.21 2000/04/07 16:27:54 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -177,6 +177,8 @@ _mesa_PushAttrib(GLbitfield mask) attr->Lighting = ctx->Light.Enabled; attr->LineSmooth = ctx->Line.SmoothFlag; attr->LineStipple = ctx->Line.StippleFlag; + attr->Histogram = ctx->Pixel.HistogramEnabled; + attr->MinMax = ctx->Pixel.MinMaxEnabled; attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled; attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled; attr->Map1Color4 = ctx->Eval.Map1Color4; @@ -198,6 +200,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->Map2Vertex3 = ctx->Eval.Map2Vertex3; attr->Map2Vertex4 = ctx->Eval.Map2Vertex4; attr->Normalize = ctx->Transform.Normalize; + attr->PixelTexture = ctx->Pixel.PixelTextureEnabled; attr->PointSmooth = ctx->Point.SmoothFlag; attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint; attr->PolygonOffsetLine = ctx->Polygon.OffsetLine; @@ -531,6 +534,7 @@ _mesa_PopAttrib(void) TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, GL_MAP2_VERTEX_4); TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE); TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, GL_RESCALE_NORMAL_EXT); + TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint, GL_POLYGON_OFFSET_POINT); TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine, GL_POLYGON_OFFSET_LINE); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index db3a14ba984..8c2be5d497e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.54 2000/04/07 00:19:41 brianp Exp $ */ +/* $Id: context.c,v 1.55 2000/04/07 16:27:26 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1115,6 +1115,11 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Pixel.MapGtoG[0] = 0.0; ctx->Pixel.MapBtoB[0] = 0.0; ctx->Pixel.MapAtoA[0] = 0.0; + ctx->Pixel.HistogramEnabled = GL_FALSE; + ctx->Pixel.MinMaxEnabled = GL_FALSE; + ctx->Pixel.PixelTextureEnabled = GL_FALSE; + ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; /* Point group */ ctx->Point.SmoothFlag = GL_FALSE; diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index d8b35279439..23479bf321f 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,4 +1,4 @@ -/* $Id: drawpix.c,v 1.16 2000/04/01 05:42:06 brianp Exp $ */ +/* $Id: drawpix.c,v 1.17 2000/04/07 16:27:26 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -37,9 +37,11 @@ #include "mem.h" #include "mmath.h" #include "pixel.h" +#include "pixeltex.h" #include "span.h" #include "state.h" #include "stencil.h" +#include "texture.h" #include "types.h" #include "zoom.h" #endif @@ -125,6 +127,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, && ctx->Pixel.AlphaBias==0.0 && ctx->Pixel.AlphaScale==1.0 && ctx->Pixel.IndexShift==0 && ctx->Pixel.IndexOffset==0 && ctx->Pixel.MapColorFlag==0 + && ctx->Texture.ReallyEnabled == 0 && unpack->Alignment==1 && !unpack->SwapBytes && !unpack->LsbFirst) { @@ -645,6 +648,17 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, _mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba, format, type, source, unpack, GL_TRUE); + if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { + GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; + GLuint unit; + /* XXX not sure how multitexture is supposed to work here */ + for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) { + _mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba, + s, t, r, q); + gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba); + } + } + if (quickDraw) { (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y, (CONST GLubyte (*)[]) rgba, NULL); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index fa0c84f1731..37090d9c2fa 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.13 2000/04/04 15:14:10 brianp Exp $ */ +/* $Id: enable.c,v 1.14 2000/04/07 16:27:26 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -467,6 +467,16 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + ctx->Pixel.PixelTextureEnabled = state; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + ctx->Pixel.PixelTextureEnabled = state; + break; + default: if (state) { gl_error( ctx, GL_INVALID_ENUM, "glEnable" ); @@ -671,6 +681,16 @@ _mesa_IsEnabled( GLenum cap ) return GL_FALSE; } + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + return ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + return ctx->Pixel.PixelTextureEnabled; + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); return GL_FALSE; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 65495a48a09..d0a30eed370 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.21 2000/03/28 16:59:39 rjfrank Exp $ */ +/* $Id: extensions.c,v 1.22 2000/04/07 16:27:26 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -78,7 +78,9 @@ static struct { int enabled; const char *name; } default_extensions[] = { { DEFAULT_OFF, "GL_EXT_vertex_array_set" }, { DEFAULT_OFF, "GL_EXT_texture_env" }, { DEFAULT_ON, "GL_EXT_texture_lod_bias" }, - { DEFAULT_OFF, "GL_HP_occlusion_test" } + { DEFAULT_OFF, "GL_HP_occlusion_test" }, + { DEFAULT_ON, "GL_SGIS_pixel_texture" }, + { DEFAULT_ON, "GL_SGIX_pixel_texture" } }; diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 2552f305191..de7b108df84 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.17 2000/04/04 15:14:10 brianp Exp $ */ +/* $Id: get.c,v 1.18 2000/04/07 16:27:26 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -58,6 +58,28 @@ #endif +static GLenum +pixel_texgen_mode(const GLcontext *ctx) +{ + if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_RGBA; + } + else { + return GL_RGB; + } + } + else { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_ALPHA; + } + else { + return GL_NONE; + } + } +} + + void _mesa_GetBooleanv( GLenum pname, GLboolean *params ) @@ -1042,6 +1064,19 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) } return; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLboolean) pixel_texgen_mode(ctx); + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); } @@ -2034,6 +2069,19 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) } return; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLdouble) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLdouble) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLdouble) pixel_texgen_mode(ctx); + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); } @@ -3003,6 +3051,19 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) } return; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLfloat) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLfloat) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLfloat) pixel_texgen_mode(ctx); + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); } @@ -3995,6 +4056,19 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) } return; + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLint) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLint) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLint) pixel_texgen_mode(ctx); + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 5c3b316f89c..990cd4d31c4 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.6 2000/04/01 05:42:06 brianp Exp $ */ +/* $Id: state.c,v 1.7 2000/04/07 16:27:26 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -64,6 +64,7 @@ #include "mmath.h" #include "pipeline.h" #include "pixel.h" +#include "pixeltex.h" #include "points.h" #include "polygon.h" #include "quads.h" @@ -525,6 +526,17 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; + /* GL_SGIX_pixel_texture */ + exec->PixelTexGenSGIX = _mesa_PixelTexGenSGIX; + + /* GL_SGIS_pixel_texture */ + exec->PixelTexGenParameteriSGIS = _mesa_PixelTexGenParameteriSGIS; + exec->PixelTexGenParameterivSGIS = _mesa_PixelTexGenParameterivSGIS; + exec->PixelTexGenParameterfSGIS = _mesa_PixelTexGenParameterfSGIS; + exec->PixelTexGenParameterfvSGIS = _mesa_PixelTexGenParameterfvSGIS; + exec->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; + exec->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; + /* GL_EXT_compiled_vertex_array */ exec->LockArraysEXT = _mesa_LockArraysEXT; exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; |