mesa: reimplement IROUND(), add F_TO_I()
[mesa.git] / src / mesa / main / points.c
index 7e189a0a8c9dcec51e193c11d9337309d453d5fb..87bfae27eba9dd0d5c8d4b0fa6e5bae0a0b100bf 100644 (file)
@@ -32,7 +32,6 @@
 #include "context.h"
 #include "macros.h"
 #include "points.h"
-#include "texstate.h"
 #include "mtypes.h"
 
 
@@ -69,8 +68,10 @@ _mesa_PointSize( GLfloat size )
 void GLAPIENTRY
 _mesa_PointParameteri( GLenum pname, GLint param )
 {
-   const GLfloat value = (GLfloat) param;
-   _mesa_PointParameterfv(pname, &value);
+   GLfloat p[3];
+   p[0] = (GLfloat) param;
+   p[1] = p[2] = 0.0F;
+   _mesa_PointParameterfv(pname, p);
 }
 
 
@@ -90,7 +91,10 @@ _mesa_PointParameteriv( GLenum pname, const GLint *params )
 void GLAPIENTRY
 _mesa_PointParameterf( GLenum pname, GLfloat param)
 {
-   _mesa_PointParameterfv(pname, &param);
+   GLfloat p[3];
+   p[0] = param;
+   p[1] = p[2] = 0.0F;
+   _mesa_PointParameterfv(pname, p);
 }
 
 
@@ -200,6 +204,11 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
          }
          break;
       case GL_POINT_SPRITE_COORD_ORIGIN:
+        /* This is not completely correct.  GL_POINT_SPRITE_COORD_ORIGIN was
+         * added to point sprites when the extension was merged into OpenGL
+         * 2.0.  It is expected that an implementation supporting OpenGL 1.4
+         * and GL_ARB_point_sprite will generate an error here.
+         */
          if (ctx->Extensions.ARB_point_sprite) {
             GLenum value = (GLenum) params[0];
             if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
@@ -236,11 +245,11 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
  *
  * \param ctx GL context.
  *
- * Initializes __GLcontextRec::Point and point related constants in
- * __GLcontextRec::Const.
+ * Initializes __struct gl_contextRec::Point and point related constants in
+ * __struct gl_contextRec::Const.
  */
 void
-_mesa_init_point(GLcontext *ctx)
+_mesa_init_point(struct gl_context *ctx)
 {
    GLuint i;
 
@@ -257,7 +266,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 < Elements(ctx->Point.CoordReplace); i++) {
       ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */
    }
 }