On the subject of point sprites

are all 4 vertices of the point sprite read as the same in the fragment shader?
from the looks of it they are!! (which i assume to be the center of the point sprite)
surly this cant be right

Isn’t a point sprite just one vertex? The resulting fragments are accessible via texture coordinates s & t in gl_TexCoord[0]. Does this clarify?

i mean say the 4 vertices of the pointsprite are in worldspace
( 10,-10,0)
( 10, 10,0)
(-10, 10,0)

now say in the fragment program u have a function that takes the vertices position and then shades depending on that, say green y<0 + blue above y>0.
now u would want the top half of the point sprite blue and bottom green but in actual fact all calcluations are done as if the pointsprites position was (0,0,0), not good.

just continuing my ongoing one man campaign to get pointsprites banned :slight_smile:

If they are banned I will be very dissappointed… :wink:

Point sprites don’t have 4 vertices? As I understand it ONE vertex is sent to vertex shader. Fragments are created from this one vertex depending on gl-state glPointSize().

if you want a multicolored point sprite you will have to color it in the fragment shader depending on texture coordinates, s & t.

if s > 0.5 blue
else green
( or is it t?, can’t remember which is vertical…)

Yes, it’s only one vertex and thus only one invocation of the vertex shader per sprite.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.