View Full Version : GL_POINT_SPRITE_ARB and glsl

10-05-2007, 09:29 AM
Is is possible to use GL_POINT_SPRITE_ARB with a glsl vertex and fragement shader?

10-05-2007, 11:12 AM
Its possible with GLSL Ver. 1.2 thanks to the new buildin variables "gl_PointSize" and "gl_PointCoord".
As far as I know ATI only supports GLSL 1.1, so you have
to write a fallback for these cards.

Have a look at this thread (http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=3;t=015419#000000) for some shadersource.

10-09-2007, 09:00 AM
For the record and just to clarify:

I want to use GL_POINT_SPRITE so that I only send a list of points, but the vertex shader receives three verts for each point submitted, and the fragment shader receives automatic teture coords.

It appears this does work. I draw the points with a vbo
glDrawArrays(GL_POINTS, 0, pointCount);

and the currently enabled vertex and fragment shaders are recieving the billboarded tris with texture coords set.

btw - This is on a mac with a GeForce 8600 GTM

10-09-2007, 06:30 PM
I dont think you are seeing what you think you are. Unless I'm mistaken the 'billboard' is created in the rasterization stage, after the vertex shader. You will only receive one vertex for each point sprite (the one you specify).

10-10-2007, 12:13 AM
You are probably right - I may only be seeing one vert in the vert shader...not sure how to tell.

But I was unclear whether I could use a custom fragment shader - and the answer to that is yes :-)

Thanks for your post...