I had FSAA working in my app until I upgraded to the latest NVidia drivers for linux. For some reason it doesn’t work now. I don’t use glut or anything so this might not work for you if you use a helper library.
First create a normal GL window and context.
I used the following attributes to glXChooseVisual.
int attrListDbl = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4,
GLX_DEPTH_SIZE, 16,
None};
then I check if GL_ARB_multisample is in the extensions string. Just check out the nehe.gamedev.net tutorial for extensions to see how to do that.
If the extension exists I destroy the window and recreate a new one with the following arguments to glXChooseVisual.
int attrListDblmultis = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4,
GLX_DEPTH_SIZE, 16,
GLX_SAMPLE_BUFFERS_ARB, 1, GLX_SAMPLES_ARB, 1,
None };
Of course you should probably iterate the the GLX_SAMPLES_ARB to find the best mode available by your graphics card.
Then enable multisampling by
glEnable(GL_MULTISAMPLE_ARB);
I also wrapped all of my antialiasing code in #ifdef’s so I could build the project on old versions of gl which don’t have multisample support.
This seemed to work great for me until I upgraded the nvidia drivers. I’m not sure if I’m doing something wrong or if the drivers have a bug. If I set the Nvidia environment variables to force FSAA the app will be antialiased. glDisable will switch the AA from the environment specified to what I specified in the app. Strange. Maybe you’ll have better luck.