5

I'm trying to code (in c, using opengl) a piece of a boardgame using GL_POINT for each piece. I have the following code:

        glEnable(GL_POINT_SMOOTH);
        glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
        glPointSize(20.0f);
        glBegin(GL_POINTS);

        glVertex2d(200, 200);

        glEnd();

Bur for some reason the point always shows as a square, instead of a circle... Does anyone know why?

dasen
  • 389
  • 2
  • 8
  • 13
  • 2
    This could be your GPU, or the graphics driver. Some vendor implementations of `GL_POINT_SMOOTH` still result in square points. If you switch to software rasterizer (like MesaGL), then it could work, but otherwise, you are at the mercy of your GPU vendor for this to work. Also this thread: http://stackoverflow.com/questions/1513811/getting-smooth-big-points-in-opengl – wkl Nov 23 '10 at 16:00

1 Answers1

7

Actually, to get smoothing to work, you probably just need to enable blending. Try adding:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

I know this is necessary for line smoothing, and I'm pretty sure it's the same for points.

Cheers, -matt

Gretchen
  • 2,274
  • 17
  • 16