PDA

View Full Version : Pixel-Coords of a vertex



hillar
02-25-2005, 05:11 AM
Hi

I am rendering GL_POINTS and need the distance of a fragment to the point-center in the fragment-shader, as a float, measured in pixels. For this i want to compute the pixel-coords of the vertex in the vertex-shader and pass the result as a varying to the fragment-shader and compute the distance using gl_Fragcoord.

But how do i get the pixel-cords of a vertex?

Relic
02-25-2005, 06:21 AM
By doing the same what gluProject does:
http://pyopengl.sourceforge.net/documentation/manual/gluProject.3G.html
The only problem would be clipping.
Check the OpenGL 2.0 spec 2.11 and 2.12 for the detailed description.

hillar
02-25-2005, 06:28 AM
thanks, that is what i was looking for!