June 2013
Intermediate to advanced
346 pages
8h 42m
English
You may have noticed that our points are being rendered as small squares, with the number of pixels on each side equal to the value of gl_PointSize. Using another special OpenGL variable, gl_PointCoord, we can actually customize the appearance of our points. For each point, when the fragment shader is run, we’ll get a two-dimensional gl_PointCoord coordinate with each component ranging from 0 to 1 on each axis, depending on which fragment in the point is currently being rendered.
To see how this works, we’ll first use gl_PointCoord to draw our fragments as circles instead of squares. How can we do this? Well, each point will be rendered with fragments that range from 0 to 1 on each axis relative to
Read now
Unlock full access