PDA

View Full Version : on the subject of point sprites



zed
01-18-2005, 05:07 PM
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

thinks
01-18-2005, 09:59 PM
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?

zed
01-19-2005, 11:36 AM
i mean say the 4 vertices of the pointsprite are in worldspace
(-10,-10,0)
( 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 :)

thinks
01-20-2005, 04:07 AM
If they are banned I will be very dissappointed... ;)

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...)

Humus
01-22-2005, 09:59 AM
Yes, it's only one vertex and thus only one invocation of the vertex shader per sprite.