I'm trying to draw a circle with OpenGL using glDrawArrays and GL_POINTS. My circle is drawn correct, but each point has got a white border (see screenshot).
Here is the code:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
Color* color = (Color*)colors;
glEnableClientState(GL_VERTEX_ARRAY);
pointSize *= this->GetScale();
glPointSize(pointSize);
glColor4f(color->r/255.0f, color->g/255.0f, color->b/255.0f, 1.0f);
glVertexPointer(2, GL_FLOAT, 0, verts);
glDrawArrays(GL_POINTS, 0, count);
glDisableClientState(GL_VERTEX_ARRAY);
I think, something's wrong with blending mode, but I can't find the right one. Any suggestions?
I believe GL_POINT_SMOOTH is intended to be used with saturation blending glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE) as the alpha is calculated as a portion of the pixel that the sprite overlaps. The depth buffer may interfere with the rendering too.
For a more accurate circle I'd suggest using a triangle strip, or even a single textured or (if using shaders, implicitly coloured in the fragment shader) quad.