Request desktop OpenGL compatibility profile at startup

The visualization framework requires desktop OpenGL with the fixed-function
pipeline. Qt may otherwise create an OpenGL ES or core profile context on
some platforms (e.g. Wayland/EGL on Ubuntu 26.04), causing all 3D rendering
to fail with shader compile errors.
This commit is contained in:
Kristian Bendiksen
2026-09-01 07:44:52 +02:00
committed by Magne Sjaastad
parent 7e1c38bf99
commit 2443c4088d
+11
View File
@@ -38,6 +38,7 @@
#include "cvfqtUtils.h"
#include <QFile>
#include <QSurfaceFormat>
#include <QtGlobal>
#ifndef WIN32
@@ -124,6 +125,16 @@ int main( int argc, char* argv[] )
// See test application QtTestBenchOpenGLWidget
QApplication::setAttribute( Qt::AA_ShareOpenGLContexts );
// The visualization framework requires desktop OpenGL with the fixed-function pipeline. Request
// this explicitly, as Qt may otherwise create an OpenGL ES or core profile context on some
// platforms (e.g. Wayland/EGL), causing all 3D rendering to fail.
{
QSurfaceFormat surfaceFormat = QSurfaceFormat::defaultFormat();
surfaceFormat.setRenderableType( QSurfaceFormat::OpenGL );
surfaceFormat.setProfile( QSurfaceFormat::CompatibilityProfile );
QSurfaceFormat::setDefaultFormat( surfaceFormat );
}
// Create feature manager before the application object is created
RiaMainTools::initializeSingletons();
RiaQuantityInfoTools::initializeSummaryKeywords();