16. OpenGL in VisIt

VisIt requires an OpenGL 3.2 context to work properly. Mesa provides a 3.3 context. Most desktop computers or laptops with graphics cards provide an OpenGL 4.6 or 4.7 context. For some unknown reason most (if not all) Linux HPC systems only provide a 3.0 context.

When using the QVTKOpenGLWidget with Qt, the following code snippet needs to be executed before creating the QApplication to tell Qt that it needs an OpenGL 3.2 context.

//
// Setting default QSurfaceFormat required with QVTKOpenGLwidget.
//
auto surfaceFormat = QVTKOpenGLWidget::defaultFormat();
surfaceFormat.setSamples(0);
surfaceFormat.setAlphaBufferSize(0);
QSurfaceFormat::setDefaultFormat(surfaceFormat);

16.1. OpenGL in Qt

The sections of Qt that deal with OpenGL are

qtbase/src/opengl
qtbase/src/openglextensions

qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_glx

qtbase/src/platformsupport/glxconvenience

The context creation is performed in

qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp

void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)

16.2. OpenGL in VTK

The sections of VTK that deal with OpenGL are

GUISupport/Qt
Rendering/OpenGL2

The context creation is performed in

GUISupport/Qt/QVTKOpenGLWidget.cxx

Other stuff is done in

Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx

16.3. OpenGL documentation

GLX is the OpenGL extension to the X Window System. In the X Window System, OpenGL rendering is made available as an extension to X in the formal X sense: connection and authentication are accomplished with the normal X mechanisms. As with other X extensions, there is a defined network protocol for the OpenGL rendering commands encapsulated within the X byte stream.

Since performance is critical in 3D rendering, there is a way for OpenGL rendering to bypass the data encoding step, the data copying, and interpretation of that data by the X server. This direct rendering is possible only when a process has direct access to the graphics pipeline.