Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't "glEnable(GL_POINT_SMOOTH);" work to make the following point as a circle?

Tags:

c

opengl

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?

like image 456
dasen Avatar asked Nov 23 '10 15:11

dasen


1 Answers

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

like image 137
Gretchen Avatar answered Oct 03 '22 03:10

Gretchen