gl_PointCoord issue

When I try to use gl_PointCoord in my fragment shader to make point sprites its value is always 0,0.

It would be great if someone provided me with a working example(with source) that uses gl_PointCoord to texture map point sprites(preferably for Windows) so I can see myself what I have done wrong(or if it is a driver problem), otherwise you can still suggest possible sources of error. Any help is appreciated.

I am pretty sure I have all the enables I need:


But in my fragment shader gl_PointCoord is 0,0 no matter what.

Meanwhile I have ‘emulated’ gl_PointCoord by converting the position of the vertex after it is multiplied by the matrix into screen coordinates and storing this in a varying, and then using this value with gl_FragCoord to calculate the difference and and divide with point size to get values ranging from 0 to 1…hopefully you understand but this is not really relevant to the problem.

edit: to not have to create a topic for such a simple question, is dividing a fixed starting value by the depth the way to go to do point sprite distance attenuation?

You may check the following page where I am using the gl_PointCoord to render point sprites as spheres.
Demo source code :