diff --git a/modules/v4d/src/detail/framebuffercontext.cpp b/modules/v4d/src/detail/framebuffercontext.cpp index 91391b619..e0418a3fe 100644 --- a/modules/v4d/src/detail/framebuffercontext.cpp +++ b/modules/v4d/src/detail/framebuffercontext.cpp @@ -693,6 +693,7 @@ void FrameBufferContext::begin(GLenum framebufferTarget) { } void FrameBufferContext::end() { + this->makeCurrent(); GL_CHECK(glFlush()); } diff --git a/modules/v4d/src/detail/nanoguicontext.cpp b/modules/v4d/src/detail/nanoguicontext.cpp index 7f57727b5..b1b7b5efd 100644 --- a/modules/v4d/src/detail/nanoguicontext.cpp +++ b/modules/v4d/src/detail/nanoguicontext.cpp @@ -71,6 +71,7 @@ void NanoguiContext::render(bool print, bool graphical) { { #ifndef __EMSCRIPTEN__ mainFbContext_.makeCurrent(); + GL_CHECK(glFinish()); GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)); GL_CHECK(glViewport(0, 0, mainFbContext_.getWindowSize().width, mainFbContext_.getWindowSize().height)); glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); @@ -109,6 +110,8 @@ void NanoguiContext::render(bool print, bool graphical) { { #ifdef __EMSCRIPTEN__ FrameBufferContext::GLScope glScope(fbCtx(), GL_FRAMEBUFFER); +#else + GL_CHECK(glFinish()); #endif screen().draw_widgets(); } diff --git a/modules/v4d/src/v4d.cpp b/modules/v4d/src/v4d.cpp index 1211d216e..4027abd12 100644 --- a/modules/v4d/src/v4d.cpp +++ b/modules/v4d/src/v4d.cpp @@ -541,13 +541,14 @@ bool V4D::display() { #endif run_sync_on_main<6>([&, this](){ { - FrameBufferContext::GLScope glScope(fbCtx(), GL_READ_FRAMEBUFFER); - fbCtx().blitFrameBufferToScreen(viewport(), fbCtx().getWindowSize(), isFrameBufferScaling()); + FrameBufferContext::GLScope glScope(fbCtx(), GL_READ_FRAMEBUFFER); + fbCtx().blitFrameBufferToScreen(viewport(), fbCtx().getWindowSize(), isFrameBufferScaling()); } #ifndef __EMSCRIPTEN__ nguiCtx().render(printFPS_, showFPS_); #endif fbCtx().makeCurrent(); + GL_CHECK(glFinish()); #ifndef __EMSCRIPTEN__ glfwSwapBuffers(fbCtx().getGLFWWindow()); #else