Here is my code:
#include <windows.h>
#include "GL/GL.h"
#include "GL/GLU.h"
#include "GL/glut.h"
void render()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glColor3d(1, 0, 0);
glVertex2d(0, -1);
glColor3d(0, 1, 0);
glVertex2d(1, 1);
glEnd();
glBegin(GL_POLYGON);
glColor3d(1, 0, 0);
glVertex2d(-0.6, 0.3);
glColor3d(0, 1, 0);
glVertex2d(1, 1);
glColor3d(0, 0, 1);
glVertex2d(0, 0);
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutInitWindowSize(600, 400);
glutInitWindowPosition(100, 100);
glutCreateWindow("Lesson 1");
glutDisplayFunc(render);
glClearColor(0, 0, 0, 0);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glPointSize(10);
glLineWidth(50);
glutMainLoop();
return 0;
}
And here is the result.
Why polygons are not anti-aliased?
Please note that I have tried to use glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
and it didn't help.