From cc5745dbb52396c16d4ba636b9f1823724ba8312 Mon Sep 17 00:00:00 2001 From: schultz Date: Fri, 9 Feb 2018 11:38:50 +0100 Subject: [PATCH] fixes #9 by recerating the opengl context after QMainWindow->show was called --- Core/Core.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Core/Core.cc b/Core/Core.cc index 4f947a9a..49f31e71 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -98,6 +98,18 @@ //== IMPLEMENTATION ========================================================== +namespace { + void recreateContext() + { + QOpenGLContext* ctx = QOpenGLContext::currentContext(); + QSurfaceFormat format = QSurfaceFormat::defaultFormat(); + ctx->setFormat(format); + ctx->create(); + QOffscreenSurface* surface = new QOffscreenSurface(); + ctx->makeCurrent(surface); + } +} + /** \brief Constuctor for the Core Widget ( This is stage 1 , call init for stage 2) * * Initialization is working the following way:\n @@ -653,6 +665,7 @@ Core::init() { coreWidget_->splitter_->restoreState (windowStates.value("Core/LogSplitter").toByteArray ()); coreWidget_->show(); + recreateContext(); applyOptions(); @@ -671,6 +684,8 @@ Core::init() { } else { coreWidget_->show(); + recreateContext(); + applyOptions(); } -- GitLab