So, you know how in your Nvidia or ATI driver setting you always get Anti-Alias options for 2x, 4x, 8x, 16x etc or you can set it to Application controlled?
Ok, so assuming the driver is set to Application Controlled, how do you control that inside your application?
I know you enable/disable via GL_MULTISAMPLE, but how can you set it to 8x as opposed to 16x? Is that done by creating a new window/context with more/less AA bits every time? Or is there another way?
when you create your context (through wgl on Windows or glx on Linux, or carbon|cocoa|glx interface on Mac) you can specify the desired number of samples per pixel in multisampling mode.
Also ,if available on your card, you can try extension GL_NV_multisample_filter_hint:
Or better render to a multisampled FBO, it is very easy to select the number of samples there, and destroying and recreating them with other settings can be done on the fly, without the need to re-create the context.
Right. On Linux specifically, you can specify a number of samples when you choose which X visual to create your X window in, but that doesn’t give you full control. On Linux+NVidia, you can’t easily select specific combinations of multisampling, supersampling, coverage sampling, etc. programmatically (e.g. say you want 8xMS+4xSS on a GeForce 8)
The best way I know of to set a specific mode on NVidia/Linux is the __GL_FSAA_MODE environment variable – see the /usr/share/doc/NVIDIA_GLX-1.0/README.txt for details. I think this is even the “only” way for some modes.
This does work! But the unfortunate thing about this vendor-specific scheme is you can’t nail your app to a particular antialiasing mode, because what the mode numbers are, and even which modes are available even on the same GPU can and do sometimes vary between driver versions! For instance, 8xMS+4xSS used to be available on NVidia/Linux/GeForce 8, but not with the latest drivers…
However, since OpenGL doesn’t mandate specific AA capabilities for GL windows, a standard query-and-set API would be about as good as we could hope for for setting GL window AA, even if it only worked with strings (ala GL_RENDERER, GL_EXTENSIONS, etc.).
In contrast, FBOs let you clearly specify what you want (if pure multisampling or pure coverage sampling is sufficient). Maybe someday we’ll have framebuffer_multisample++ with an abstract API to support SS or MS+SS+CS mixed formats, and framebuffer_blit which would just do the right thing for these new formats like it does now with MS.