Although I have been discouraged from reading the OpenGL redbook, I am still doing it, because it is the only book designed for beginners, and tutorials and/or documentation don't quite substitute for a book although very important. So much for justifying myself :)
Now, there's an example for antialiasing using multisampling, which involved
glEnable(GL_MULTISAMPLE);
I am using Qt, and I get a compile error, because GL_MULTISAMPLE is an undeclared identifier. I currently see the following reasons:
<QGLWidget>
or does not come with QtIs one of the above reasons correct? If not, which is the reason I don't have it and how can I obtain? Thanks in advance
Since you said you're using Qt's libraries then GLEW etc probably isn't necessary since Qt wraps and binds the extensions for you.
If you're using QGLWidget it's particularly easy. Check this example that ships with Qt and uses GL_MULTISAMPLE
, particularly the glwidget.cpp file which defines:
#ifndef GL_MULTISAMPLE
#define GL_MULTISAMPLE 0x809D
#endif
If you want to customise the FSAA samples, pass your own QGLFormat to the QGLWidget constructor eg:
QGLFormat format;
format.setDoubleBuffer(true);
format.setDepth(false);
format.setAlpha(false);
format.setSampleBuffers(true);
format.setSamples(4);
QGLWidget *glw = new QGLWidget(format);
Change format.setSamples(4)
to your liking. Be sure to add glEnable(GL_MULTISAMPLE)
in your paintGL() function before rendering your scene.