[vtk-developers] Multisampling in VTK

Aashish Chaudhary aashish.chaudhary at kitware.com
Wed Jan 8 12:43:30 EST 2014


Folks,

While looking into some failing test on Linux, we realized this code below
in vtkOpenGLRenderWindow

// Initialize static member that controls global maximum number of
multisamples
// (off by default on Apple because it causes problems on some Mac models).
#if defined(__APPLE__)
static int vtkOpenGLRenderWindowGlobalMaximumNumberOfMultiSamples = 0;
#else
static int vtkOpenGLRenderWindowGlobalMaximumNumberOfMultiSamples = 8;
#endif


and in vtkXOpenGLRenderWindow.cxx
if (multisamples)
    {
#ifdef GLX_SAMPLE_BUFFERS_SGIS
    attributes[index++] = GLX_SAMPLE_BUFFERS_SGIS;
    attributes[index++] = 1;
    attributes[index++] = GLX_SAMPLES_SGIS;
    attributes[index++] = multisamples;
#endif
    }

Basically in OpenGL, we can achieve anti-aliasing for each primitive type
by invoking enable / disable on GL_POINT_SMOOTH, GL_LINE_SMOOTH or
GL_POLYGON_SMOOTH. The other route that applies anti-aliasing to all of
the primitives is to use mutli-sampling if available (this always wins if
both methods are used). Now by default, on LINUX (the code above set the
sample size to 0 effectively disabling anti-aliasing) we have anti-aliasing
ON with a sample size of 8. The anti-aliasing is an expensive operation and
not all of the implementation supports it (Please refer to the
documentation on GLX_SAMPLES_SGIS or ARB_multisample).

I am asking if we should set the sample size to 0 default on Linux as well
(like Mac) and if applications needs it then they can explicitly turn it
ON. I can make an argument for either side but I am bit more inclined
towards setting it to 0 so that applications can still control it if wanted
but if not they won't get it by default (and will get better performance
overall).

Now we don't agree on this, can we agree on setting to 0 for testing (May
be via environment variable like others we used in our testing?)


Thoughts?

Helpful links:
http://www.opengl.org/registry/specs/ARB/multisample.txt
http://www.opengl.org/registry/specs/SGIS/multisample.txt
http://www.opengl.org/wiki/Multisampling


- Aashish



-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20140108/626dc6ea/attachment.html>


More information about the vtk-developers mailing list