Merge commit 'origin/master' into gallium-0.2
[mesa.git] / src / mesa / main / points.c
index e83db5de78d60e64b720637e1aa2eb333207a0ff..4c8fc1f72e0dfa239185f30df6ebb131a1e4d13d 100644 (file)
@@ -5,7 +5,7 @@
 
 /*
  * Mesa 3-D graphics library
- * Version:  7.0
+ * Version:  7.1
  *
  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
@@ -65,45 +65,37 @@ _mesa_PointSize( GLfloat size )
 
 #if _HAVE_FULL_GL
 
-/*
- * Added by GL_NV_point_sprite
- */
+
 void GLAPIENTRY
-_mesa_PointParameteriNV( GLenum pname, GLint param )
+_mesa_PointParameteri( GLenum pname, GLint param )
 {
    const GLfloat value = (GLfloat) param;
-   _mesa_PointParameterfvEXT(pname, &value);
+   _mesa_PointParameterfv(pname, &value);
 }
 
 
-/*
- * Added by GL_NV_point_sprite
- */
 void GLAPIENTRY
-_mesa_PointParameterivNV( GLenum pname, const GLint *params )
+_mesa_PointParameteriv( GLenum pname, const GLint *params )
 {
-   const GLfloat value = (GLfloat) params[0];
-   _mesa_PointParameterfvEXT(pname, &value);
+   GLfloat p[3];
+   p[0] = (GLfloat) params[0];
+   if (pname == GL_DISTANCE_ATTENUATION_EXT) {
+      p[1] = (GLfloat) params[1];
+      p[2] = (GLfloat) params[2];
+   }
+   _mesa_PointParameterfv(pname, p);
 }
 
 
-
-/*
- * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
- */
 void GLAPIENTRY
-_mesa_PointParameterfEXT( GLenum pname, GLfloat param)
+_mesa_PointParameterf( GLenum pname, GLfloat param)
 {
-   _mesa_PointParameterfvEXT(pname, &param);
+   _mesa_PointParameterfv(pname, &param);
 }
 
 
-
-/*
- * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
- */
 void GLAPIENTRY
-_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
+_mesa_PointParameterfv( GLenum pname, const GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -118,6 +110,11 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
             ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
                                       ctx->Point.Params[1] != 0.0 ||
                                       ctx->Point.Params[2] != 0.0);
+
+            if (ctx->Point._Attenuated)
+               ctx->_TriangleCaps |= DD_POINT_ATTEN;
+            else
+               ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
@@ -203,7 +200,7 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
          }
          break;
       case GL_POINT_SPRITE_COORD_ORIGIN:
-         if (ctx->Extensions.ARB_point_sprite) {
+         if (ctx->Extensions.ARB_point_sprite || ctx->Extensions.NV_point_sprite) {
             GLenum value = (GLenum) params[0];
             if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
                _mesa_error(ctx, GL_INVALID_VALUE,
@@ -260,7 +257,7 @@ _mesa_init_point(GLcontext *ctx)
    ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */
    ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */
    ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */
-   for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
+   for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
       ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */
    }
 }