gl_PointCoord is giving me junk values!

I’m trying and failing to use point sprites with GLSL. For some reason the values in gl_PointCoord seem random.

Here are my shaders:


#version 120

uniform mat4 projection_matrix;

uniform mat4 modelview_matrix;

uniform float point_size;

attribute vec3 a_Vertex;

void main(void)


vec4 pos = modelview_matrix * vec4(a_Vertex, 1.0);

gl_PointSize = point_size;
gl_Position = projection_matrix * pos;



#version 120

uniform sampler2D texture0;

void main(void) {

gl_FragColor = texture2D(texture0, gl_PointCoord);


This looked like it was just sampling the texture randomly… a bit like static on a TV screen (the texture was black and white so it looked exactly like that).

So what I decided to try was output the ‘s’ coordinate of gl_PointCoord as the red component of the output color. Instead of a smooth gradient as I was expecting (as ‘s’ increases from zero to one) it again looked like static (albeit red this time).

I’m stumped. The spec says:

The values in gl_PointCoord are two-dimensional coordinates indicating where within a point primitive the current fragment is located, when point sprites are enabled. They range from 0.0 to 1.0 across the point. If the current primitive is not a point, or if point sprites are not enabled, then the values read from gl_PointCoord are undefined.

Point sprites are definitely enabled and the primitive is definitely a point.

Here’s my rendering code anyway:

glDrawArrays(GL_POINTS, 0, positions.size());

Does anyone have any clue as to what I’m doing wrong?

Are you using an ATI card? It might be fixed in Catalyst 8.12.


this issue might be the same as the one reported here:…amp;#Post267381

please track any feedback there.


Pierre B.
AMD Fellow

I use point sprites and have no problems with gl_PointSprite (though creating GL-3.1 context).
I guess this issue is fixed now, at least in Catalyst 9.10