From ea6cc026ae8e35bf806aad729f815852ee83e7d2 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 2 Apr 2020 10:46:17 +0100 Subject: [PATCH] Allow de-activating GL contexts in tests --- util/test/demos/gl/gl_test_linux.cpp | 6 ++++++ util/test/demos/gl/gl_test_win32.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/util/test/demos/gl/gl_test_linux.cpp b/util/test/demos/gl/gl_test_linux.cpp index e4ad87d3a..136d35674 100644 --- a/util/test/demos/gl/gl_test_linux.cpp +++ b/util/test/demos/gl/gl_test_linux.cpp @@ -222,6 +222,12 @@ void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx) { X11Window *x11win = (X11Window *)win; + if(ctx == NULL) + { + glXMakeContextCurrent(x11win->xlib.display, NULL, NULL, NULL); + return; + } + glXMakeContextCurrent(x11win->xlib.display, x11win->xlib.window, x11win->xlib.window, (GLXContext)ctx); } diff --git a/util/test/demos/gl/gl_test_win32.cpp b/util/test/demos/gl/gl_test_win32.cpp index 261bbfa07..a017f5633 100644 --- a/util/test/demos/gl/gl_test_win32.cpp +++ b/util/test/demos/gl/gl_test_win32.cpp @@ -257,6 +257,12 @@ void OpenGLGraphicsTest::DestroyContext(void *ctx) void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx) { + if(ctx == NULL) + { + makeCurrent(NULL, NULL); + return; + } + Win32Window *win32win = (Win32Window *)win; HDC dc = GetDC(win32win->wnd);