Still need to resolve clipping issues, finalize the spec.
-/* $Id: context.c,v 1.110 2000/11/27 18:22:13 brianp Exp $ */
+/* $Id: context.c,v 1.111 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->Point.MinSize = 0.0;
ctx->Point.MaxSize = ctx->Const.MaxPointSize;
ctx->Point.Threshold = 1.0;
+ ctx->Point.SpriteMode = GL_FALSE; /* GL_MESA_sprite_point */
/* Polygon group */
ctx->Polygon.CullFlag = GL_FALSE;
-/* $Id: enable.c,v 1.35 2000/11/27 18:59:09 brianp Exp $ */
+/* $Id: enable.c,v 1.36 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* GL_SGIS_pixel_texture */
case GL_PIXEL_TEXTURE_SGIS:
- /* XXX check for extension */
- ctx->Pixel.PixelTextureEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGIS_pixel_texture) {
+ ctx->Pixel.PixelTextureEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
/* GL_SGIX_pixel_texture */
case GL_PIXEL_TEX_GEN_SGIX:
- /* XXX check for extension */
- ctx->Pixel.PixelTextureEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGIX_pixel_texture) {
+ ctx->Pixel.PixelTextureEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
/* GL_SGI_color_table */
case GL_COLOR_TABLE_SGI:
- /* XXX check for extension */
- ctx->Pixel.ColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGI_color_table) {
+ ctx->Pixel.ColorTableEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
- ctx->Pixel.PostConvolutionColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGI_color_table) {
+ ctx->Pixel.PostConvolutionColorTableEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
- ctx->Pixel.PostColorMatrixColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGI_color_table) {
+ ctx->Pixel.PostColorMatrixColorTableEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
/* GL_EXT_convolution */
case GL_CONVOLUTION_1D:
- /* XXX check for extension */
- ctx->Pixel.Convolution1DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.EXT_convolution) {
+ ctx->Pixel.Convolution1DEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
break;
case GL_CONVOLUTION_2D:
- ctx->Pixel.Convolution2DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.EXT_convolution) {
+ ctx->Pixel.Convolution2DEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
break;
case GL_SEPARABLE_2D:
- ctx->Pixel.Separable2DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.EXT_convolution) {
+ ctx->Pixel.Separable2DEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
break;
/* GL_ARB_texture_cube_map */
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
- ctx->Fog.ColorSumEnabled = state;
- if (state)
- SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR)
- CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- ctx->NewState |= _NEW_FOG;
+ if (ctx->Extensions.EXT_secondary_color) {
+ ctx->Fog.ColorSumEnabled = state;
+ if (state)
+ SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
+ else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR)
+ CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
+ ctx->NewState |= _NEW_FOG;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ break;
+
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ ctx->Point.SpriteMode = state;
+ ctx->NewState |= _NEW_POINT;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
break;
default:
return GL_FALSE;
}
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ return ctx->Point.SpriteMode;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
return GL_FALSE;
-/* $Id: extensions.c,v 1.42 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: extensions.c,v 1.43 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
{ ON, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) },
{ ON, "GL_MESA_window_pos", F(MESA_window_pos) },
{ ON, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
+ { OFF, "GL_MESA_sprite_point", F(MESA_sprite_point) },
{ OFF, "GL_NV_blend_square", F(NV_blend_square) },
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
{ ON, "GL_PGI_misc_hints", F(PGI_misc_hints) },
gl_extensions_enable(ctx, "GL_EXT_texture_env_combine");
gl_extensions_enable(ctx, "GL_HP_occlusion_test");
gl_extensions_enable(ctx, "GL_NV_blend_square");
+ gl_extensions_enable(ctx, "GL_MESA_sprite_point");
}
-/* $Id: get.c,v 1.44 2000/11/27 18:22:13 brianp Exp $ */
+/* $Id: get.c,v 1.45 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
*params = INT_TO_BOOL(ctx->Array.FogCoord.Stride);
break;
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ *params = ctx->Point.SpriteMode;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
+ return;
+ }
+ break;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
}
*params = (GLdouble) ctx->Array.FogCoord.Stride;
break;
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ *params = (GLdouble) ctx->Point.SpriteMode;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
+ return;
+ }
+ break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
*params = (GLfloat) ctx->Array.FogCoord.Stride;
break;
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ *params = (GLfloat) ctx->Point.SpriteMode;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
+ return;
+ }
+ break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
/* GL_EXT_fog_coord */
case GL_CURRENT_FOG_COORDINATE_EXT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
- *params = (GLint) ctx->Current.FogCoord;
+ if (ctx->Extensions.EXT_fog_coord) {
+ FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ *params = (GLint) ctx->Current.FogCoord;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
- *params = (GLint) ctx->Array.FogCoord.Enabled;
+ if (ctx->Extensions.EXT_fog_coord) {
+ *params = (GLint) ctx->Array.FogCoord.Enabled;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
break;
case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
- *params = (GLint) ctx->Array.FogCoord.Type;
+ if (ctx->Extensions.EXT_fog_coord) {
+ *params = (GLint) ctx->Array.FogCoord.Type;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
break;
case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
- *params = (GLint) ctx->Array.FogCoord.Stride;
+ if (ctx->Extensions.EXT_fog_coord) {
+ *params = (GLint) ctx->Array.FogCoord.Stride;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
break;
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ *params = (GLint) ctx->Point.SpriteMode;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ return;
+ }
+ break;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
}
-/* $Id: mtypes.h,v 1.4 2000/11/28 00:07:51 brianp Exp $ */
+/* $Id: mtypes.h,v 1.5 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
struct gl_point_attrib {
GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */
+ GLboolean SpriteMode; /* GL_MESA_sprite_point extension */
GLfloat Size; /* User-specified point size */
GLfloat _Size; /* Size clamped to Const.Min/MaxPointSize */
GLfloat Params[3]; /* GL_EXT_point_parameters */
*/
struct gl_texture_unit {
GLuint Enabled; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE */
- GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */
+ GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */
GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
GLfloat EnvColor[4];
GLboolean INGR_blend_func_separate;
GLboolean MESA_window_pos;
GLboolean MESA_resize_buffers;
+ GLboolean MESA_sprite_point;
GLboolean NV_blend_square;
GLboolean NV_texgen_reflection;
GLboolean PGI_misc_hints;
-/* $Id: points.c,v 1.24 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: points.c,v 1.25 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (tmp != ctx->Point._Attenuated) {
ctx->_Enabled ^= ENABLE_POINT_ATTEN;
ctx->_TriangleCaps ^= DD_POINT_ATTEN;
+ /* XXX why is this here and not in state.c? */
ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN;
}
}
-/* $Id: state.c,v 1.50 2000/11/28 00:07:51 brianp Exp $ */
+/* $Id: state.c,v 1.51 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
}
+ /* point attenuation requires eye coords */
+ if (new_state & _NEW_POINT) {
+ if (ctx->Point._Attenuated) {
+ ctx->_NeedEyeCoords |= NEED_EYE_POINT_ATTEN;
+ }
+ }
+
/* ctx->_NeedEyeCoords and ctx->_NeedEyeNormals are now uptodate.
*
* If the truth value of either has changed, update for the new
-/* $Id: s_points.c,v 1.8 2000/12/08 00:18:39 brianp Exp $ */
+/* $Id: s_points.c,v 1.9 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
+/*
+ * Sprite (textured point)
+ */
+static void
+sprite_point( GLcontext *ctx, const SWvertex *vert )
+{
+ SWcontext *swctx = SWRAST_CONTEXT(ctx);
+ const GLfloat radius = vert->pointSize; /* XXX threshold, alpha */
+ SWvertex v0, v1, v2, v3;
+ GLuint unit;
+
+ /* lower left corner */
+ v0 = *vert;
+ v0.win[0] -= radius;
+ v0.win[1] -= radius;
+
+ /* lower right corner */
+ v1 = *vert;
+ v1.win[0] += radius;
+ v1.win[1] -= radius;
+
+ /* upper right corner */
+ v2 = *vert;
+ v2.win[0] += radius;
+ v2.win[1] += radius;
+
+ /* upper left corner */
+ v3 = *vert;
+ v3.win[0] -= radius;
+ v3.win[1] += radius;
+
+ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
+ if (ctx->Texture.Unit[unit]._ReallyEnabled) {
+ v0.texcoord[unit][0] = 0.0;
+ v0.texcoord[unit][1] = 0.0;
+ v1.texcoord[unit][0] = 1.0;
+ v1.texcoord[unit][1] = 0.0;
+ v2.texcoord[unit][0] = 1.0;
+ v2.texcoord[unit][1] = 1.0;
+ v3.texcoord[unit][0] = 0.0;
+ v3.texcoord[unit][1] = 1.0;
+ }
+ }
+
+ /* XXX if radius < threshold, attenuate alpha? */
+ /* XXX what about clipping? */
+
+ /* render */
+ swctx->Triangle(ctx, &v0, &v1, &v2);
+ swctx->Triangle(ctx, &v0, &v2, &v3);
+}
+
+
+
#ifdef DEBUG
extern void
GLboolean rgbmode = ctx->Visual.RGBAflag;
if (ctx->RenderMode==GL_RENDER) {
- if (!ctx->Point._Attenuated) {
+ if (ctx->Point.SpriteMode) {
+ /* XXX this is hacked in! */
+ swrast->Point = sprite_point;
+ }
+ else if (!ctx->Point._Attenuated) {
if (ctx->Point.SmoothFlag && rgbmode) {
swrast->Point = antialiased_rgba_point;
}
/*_mesa_print_points_function(ctx);*/
}
+
+
+#if 000 /* prototype of new point code */
+
+#define RGBA 0x1
+#define SMOOTH 0x2
+#define LARGE 0x4
+#define TEXTURE 0x8
+#define ATTENUATE 0x10
+#define SPRITE 0x20
+
+#define FLAGS (RGBA | SMOOTH | LARGE)
+#define NAME rgba_smooth_large
+#include "s_pointtemp.h"
+
+#define FLAGS (RGBA | TEXTURE | ATTENUATE)
+#define NAME rgba_texture_smooth_attenuate
+#include "s_pointtemp.h"
+
+#define FLAGS (INDEX | LARGE | ATTENUATE)
+#define NAME index_large_attenuate
+#include "s_pointtemp.h"
+
+
+static void* point_tab[0x20];
+
+void
+_swrast_choose_point( GLcontext *ctx )
+{
+ GLuint index = 0;
+
+ if (ctx->RenderMode==GL_RENDER) {
+ if (ctx->Visual.RGBAflag)
+ index |= RGBA;
+ if (ctx->Point.SmoothFlag)
+ index |= SMOOTH;
+ if (ctx->Point._Attenuated || ctx->Point.Size > 1.0)
+ index |= SIZED;
+ if (ctx->Texture.ReallyEnabled)
+ index |= TEXTURE;
+ swrast->Point = point_tab[index];
+ }
+ else if (ctx->RenderMode==GL_FEEDBACK) {
+ swrast->Point = gl_feedback_point;
+ }
+ else {
+ /* GL_SELECT mode */
+ swrast->Point = gl_select_point;
+ }
+}
+#endif