From f8a14fc69e5e0f331f72d5ac1bd81c84aae788ac Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 11 Mar 2017 16:28:26 +0100 Subject: [PATCH] Qt5OpenGL: release context when finished --- src/Gui/GLPainter.cpp | 1 + src/Gui/Quarter/QuarterWidget.cpp | 2 ++ src/Gui/View3DInventorViewer.cpp | 2 ++ src/Mod/Part/Gui/SoBrepFaceSet.cpp | 18 +++++++++--------- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Gui/GLPainter.cpp b/src/Gui/GLPainter.cpp index 078b020830..79327ccd9c 100644 --- a/src/Gui/GLPainter.cpp +++ b/src/Gui/GLPainter.cpp @@ -110,6 +110,7 @@ bool GLPainter::end() glPopAttrib(); glPopMatrix(); + viewer->doneCurrent(); viewer = 0; return true; } diff --git a/src/Gui/Quarter/QuarterWidget.cpp b/src/Gui/Quarter/QuarterWidget.cpp index e121b6a73f..3a2cc84319 100644 --- a/src/Gui/Quarter/QuarterWidget.cpp +++ b/src/Gui/Quarter/QuarterWidget.cpp @@ -826,6 +826,8 @@ void QuarterWidget::paintEvent(QPaintEvent* event) if (w->doubleBuffer()) { w->swapBuffers(); } #endif + w->doneCurrent(); + PRIVATE(this)->autoredrawenabled = true; // process the delay queue the next time we enter this function, diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 6b3b3b770a..b64e85c971 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -1349,6 +1349,7 @@ void View3DInventorViewer::setRenderType(const RenderType type) framebuffer = fbo; } #endif + gl->doneCurrent(); } break; case Image: @@ -1390,6 +1391,7 @@ void View3DInventorViewer::setRenderType(const RenderType type) glImage = fbo.toImage(false); } #endif + gl->doneCurrent(); } break; } diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.cpp b/src/Mod/Part/Gui/SoBrepFaceSet.cpp index 07e540c4cb..f5da04109b 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.cpp +++ b/src/Mod/Part/Gui/SoBrepFaceSet.cpp @@ -102,15 +102,6 @@ public: { SoContextHandler::addContextDestructionCallback(context_destruction_cb, this); - //SoBase::staticDataLock(); - static bool init = false; - if (!init) { - std::string ext = (const char*)(glGetString(GL_EXTENSIONS)); - vboAvailable = (ext.find("GL_ARB_vertex_buffer_object") != std::string::npos); - init = true; - } - //SoBase::staticDataUnlock(); - updateVbo = false; vboLoaded = false; indice_array = 0; @@ -451,6 +442,15 @@ void SoBrepFaceSet::renderColoredArray(SoMaterialBundle *const materials) #else void SoBrepFaceSet::GLRender(SoGLRenderAction *action) { + //SoBase::staticDataLock(); + static bool init = false; + if (!init) { + std::string ext = (const char*)(glGetString(GL_EXTENSIONS)); + PRIVATE(this)->vboAvailable = (ext.find("GL_ARB_vertex_buffer_object") != std::string::npos); + init = true; + } + //SoBase::staticDataUnlock(); + if (this->coordIndex.getNum() < 3) return; if (this->selectionIndex.getNum() > 0)