From faff63130c90461d7e077be68a40a716257be12d Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Mon, 29 Jan 2024 14:01:41 +0100 Subject: Fix cached GL context on all platforms (#737) --- src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/drivers/X11') diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx index 985978c1f..83bf28333 100644 --- a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx @@ -321,16 +321,16 @@ GLContext Fl_X11_Gl_Window_Driver::create_gl_context(XVisualInfo *vis) { }*/ void Fl_X11_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context) { - if (context != cached_context || w != cached_window) { - cached_context = context; + GLContext current_context = glXGetCurrentContext(); + if (context != current_context || w != cached_window) { cached_window = w; glXMakeCurrent(fl_display, fl_xid(w), (GLXContext)context); } } void Fl_X11_Gl_Window_Driver::delete_gl_context(GLContext context) { - if (cached_context == context) { - cached_context = 0; + GLContext current_context = glXGetCurrentContext(); + if (current_context == context) { cached_window = 0; glXMakeCurrent(fl_display, 0, 0); } -- cgit v1.2.3