I'm using FLTK 1.3 as base for OpenGL window context creation (Fl_Gl_Window), etc. on Mac OS X 10.9.
The goal is to create some grid with simple primitives on it. I've done some easy stuff with OpenGL in 2D before, but now i'm lost. All rendered as good, as it need to, except edges. They are all so, uhmmm... Edgy, you know.
It's obvious that this objects need some anti-aliasing in any form. Will it be simple vendor-implementation-specific smooth AA or full Multisampling. Problem is i can't turn it on in FLTK. Can't for triangles, but can for lines.
So far, i tried glEnable(GL_POLYGON_SMOOTH), multisampling on window (seems not working), different blending funcs, changing shader models.
Maybe it is because of triangle fan structure of objects? Please help me and thanks to you!
Code used for object:
float object_width = 100;
float object_height = 50;
float object_x = 250;
float object_y = 100;
glColor3f(0, 0, 1);
glBegin(GL_TRIANGLE_FAN);
for(int i = 0; i < 30; i++)
glVertex2f(object_x + (object_width / 2) * cosf(i * 12 * DEG2RAD), object_y + (object_height / 2) * sinf(i * 12 * DEG2RAD));
glEnd();
Code on window creation (just mode setting):
mode(FL_RGB | FL_ALPHA | FL_DOUBLE);
Code used on init:
glClearColor(0.9, 0.9, 0.9, 1);
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Colored output, but not smooth
//glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE_MINUS_SRC_ALPHA); // All drawn black, no smooth
//glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE); // All drawn black, no smooth either
glEnable(GL_BLEND);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH); // not working???
On different blending modes than GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA getting this picture: