diff --git a/dgl/src/pugl/pugl_win.cpp b/dgl/src/pugl/pugl_win.cpp index acf7d9f8..afbae4b3 100644 --- a/dgl/src/pugl/pugl_win.cpp +++ b/dgl/src/pugl/pugl_win.cpp @@ -87,9 +87,12 @@ void puglLeaveContext(PuglView* view, bool flush) { #ifdef PUGL_HAVE_GL - if (view->ctx_type == PUGL_GL && flush) { - glFlush(); - SwapBuffers(view->impl->hdc); + if (view->ctx_type == PUGL_GL) { + if (flush) { + glFlush(); + SwapBuffers(view->impl->hdc); + } + wglMakeCurrent(NULL, NULL); } #endif } diff --git a/dgl/src/pugl/pugl_x11.c b/dgl/src/pugl/pugl_x11.c index 0ddcd339..60be55e7 100644 --- a/dgl/src/pugl/pugl_x11.c +++ b/dgl/src/pugl/pugl_x11.c @@ -218,11 +218,14 @@ void puglLeaveContext(PuglView* view, bool flush) { #ifdef PUGL_HAVE_GL - if (view->ctx_type == PUGL_GL && flush) { - glFlush(); - if (view->impl->doubleBuffered) { - glXSwapBuffers(view->impl->display, view->impl->win); + if (view->ctx_type == PUGL_GL) { + if (flush) { + glFlush(); + if (view->impl->doubleBuffered) { + glXSwapBuffers(view->impl->display, view->impl->win); + } } + glXMakeCurrent(view->impl->display, None, NULL); } #endif }