From 491ac93924db6a9136efa38055cef7e58eccf267 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 24 Jan 2024 07:01:00 +0100 Subject: [PATCH] Set attribute to share OpenGL contexts Setting this attribute will make sure OpenGL resources are alive when the parent widget is changed during layout changes like full screen view or changing docking configuration. --- ApplicationExeCode/RiaMain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ApplicationExeCode/RiaMain.cpp b/ApplicationExeCode/RiaMain.cpp index aad55a43368..700114d1cce 100644 --- a/ApplicationExeCode/RiaMain.cpp +++ b/ApplicationExeCode/RiaMain.cpp @@ -77,6 +77,12 @@ int main( int argc, char* argv[] ) } #endif + // The Qt::AA_ShareOpenGLContexts setting is needed when we have multiple viz widgets in flight + // and we have a setup where these widgets belong to different top-level windows, or end up + // belonging to different top-level windows through re-parenting. + // See test application QtTestBenchOpenGLWidget + QApplication::setAttribute( Qt::AA_ShareOpenGLContexts ); + // Create feature manager before the application object is created RiaMainTools::initializeSingletons();