O'Reilly logo

OpenGL ES 2 for Android by Kevin Brothaler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Customizing the Appearance of Our Points

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required