summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/attrib.c4
-rw-r--r--src/mesa/main/get.c24
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/points.c24
-rw-r--r--src/mesa/swrast/s_pointtemp.h8
5 files changed, 60 insertions, 1 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 339c40b9bdd..dabb622ce08 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1017,6 +1017,10 @@ _mesa_PopAttrib(void)
_mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite);
_mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV,
ctx->Point.SpriteRMode);
+#if GL_VERSION_2_0
+ _mesa_PointParameterfEXT(GL_POINT_SPRITE_COORD_ORIGIN,
+ (GLfloat)ctx->Point.SpriteOrigin);
+#endif
}
}
break;
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 38ae4df85be..aaff7176f9f 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1390,6 +1390,12 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
CHECK_EXTENSION_B(NV_point_sprite, pname);
*params = ENUM_TO_BOOL(ctx->Point.SpriteRMode);
break;
+#if GL_VERSION_2_0
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ CHECK_EXTENSION_B(ARB_point_sprite, pname);
+ *params = ENUM_TO_BOOL(ctx->Point.SpriteOrigin);
+ break;
+#endif
/* GL_SGIS_generate_mipmap */
case GL_GENERATE_MIPMAP_HINT_SGIS:
@@ -2942,6 +2948,12 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
CHECK_EXTENSION_D(NV_point_sprite, pname);
*params = (GLdouble) ctx->Point.SpriteRMode;
break;
+#if GL_VERSION_2_0
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ CHECK_EXTENSION_D(ARB_point_sprite, pname);
+ *params = (GLdouble) ctx->Point.SpriteOrigin;
+ break;
+#endif
/* GL_SGIS_generate_mipmap */
case GL_GENERATE_MIPMAP_HINT_SGIS:
@@ -4468,6 +4480,12 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
CHECK_EXTENSION_F(NV_point_sprite, pname);
*params = (GLfloat) ctx->Point.SpriteRMode;
break;
+#if GL_VERSION_2_0
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ CHECK_EXTENSION_F(ARB_point_sprite, pname);
+ *params = (GLfloat) ctx->Point.SpriteOrigin;
+ break;
+#endif
/* GL_SGIS_generate_mipmap */
case GL_GENERATE_MIPMAP_HINT_SGIS:
@@ -6032,6 +6050,12 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
CHECK_EXTENSION_I(NV_point_sprite, pname);
*params = (GLint) ctx->Point.SpriteRMode;
break;
+#if GL_VERSION_2_0
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ CHECK_EXTENSION_I(ARB_point_sprite, pname);
+ *params = (GLint) ctx->Point.SpriteOrigin;
+ break;
+#endif
/* GL_SGIS_generate_mipmap */
case GL_GENERATE_MIPMAP_HINT_SGIS:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8fe8831e906..ba32faad703 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -890,6 +890,7 @@ struct gl_point_attrib {
GLboolean PointSprite; /**< GL_NV_point_sprite / GL_NV_point_sprite */
GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /**< GL_NV_point_sprite / GL_NV_point_sprite */
GLenum SpriteRMode; /**< GL_NV_point_sprite (only!) */
+ GLenum SpriteOrigin; /**< GL_ARB_point_sprite */
};
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index cbb91554a1e..5f5e01039c6 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -229,6 +229,27 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
return;
}
break;
+#if GL_VERSION_2_0
+ case GL_POINT_SPRITE_COORD_ORIGIN:
+ if (ctx->Extensions.ARB_point_sprite) {
+ GLenum value = (GLenum) params[0];
+ if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glPointParameterf[v]{EXT,ARB}(param)");
+ return;
+ }
+ if (ctx->Point.SpriteOrigin == value)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.SpriteOrigin = value;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glPointParameterf[v]{EXT,ARB}(pname)");
+ return;
+ }
+ break;
+#endif
default:
_mesa_error( ctx, GL_INVALID_ENUM,
"glPointParameterf[v]{EXT,ARB}(pname)" );
@@ -266,6 +287,9 @@ void _mesa_init_point( GLcontext * ctx )
ctx->Point.Threshold = 1.0;
ctx->Point.PointSprite = GL_FALSE; /* GL_ARB_point_sprite / GL_NV_point_sprite */
ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */
+#if GL_VERSION_2_0
+ ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */
+#endif
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB_point_sprite / GL_NV_point_sprite */
}
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index 3686e6a72e8..1cfdf002afd 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -292,7 +292,13 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
if (ctx->Texture.Unit[u]._ReallyEnabled) {
if (ctx->Point.CoordReplace[u]) {
GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size;
- GLfloat t = 0.5F - (y + 0.5F - vert->win[1]) / size;
+ GLfloat t;
+#if GL_VERSION_2_0
+ if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT)
+ t = 0.5F + (y + 0.5F - vert->win[1]) / size;
+ else /* GL_UPPER_LEFT */
+#endif
+ t = 0.5F - (y + 0.5F - vert->win[1]) / size;
span->array->texcoords[u][count][0] = s;
span->array->texcoords[u][count][1] = t;
span->array->texcoords[u][count][3] = 1.0F;