OpenGL ES 2.0 doesn’t have the GL_POINT_SMOOTH definition which ES 1.0 does. This means code I was using to draw circles no longer works:
glEnable(GL_POINT_SMOOTH);
glPointSize(radius*2);
glDrawArrays(GL_POINTS,0,nPoints);
Is there an equivalent in ES 2.0, perhaps something to go in the vertex shader, or must I use polygons for each circle?
You can use point sprites to emulate this. Just enable point sprites and you get a special variable
gl_PointCoordthat you can read in the fragment shader. This gives you the coordinates of the fragment in the square of the current point. You can just use these to read a texture that contains a circle (pixels not in circle have color of 0) and then discard every fragment, whose texture value is 0:EDIT: Or you can do it without a texture, by trading texture access latency for computational complexity and just evaluating the circle equation:
This might be further optimized by dropping the square root (used in the
lengthfunction) and comparing against the squared radius:But maybe the builtin
lengthfunction is even faster than this, being optimized for length computation and maybe implemented directly in hardware.