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/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/drivers/WinAPI') diff --git a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx index 0c94f8af5..d6f1a9632 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx @@ -163,16 +163,16 @@ GLContext Fl_WinAPI_Gl_Window_Driver::create_gl_context(Fl_Window* window, const } void Fl_WinAPI_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context) { - if (context != cached_context || w != cached_window) { - cached_context = context; + GLContext current_context = wglGetCurrentContext(); + if (context != current_context || w != cached_window) { cached_window = w; wglMakeCurrent(Fl_WinAPI_Window_Driver::driver(w)->private_dc, (HGLRC)context); } } void Fl_WinAPI_Gl_Window_Driver::delete_gl_context(GLContext context) { - if (cached_context == context) { - cached_context = 0; + GLContext current_context = wglGetCurrentContext(); + if (current_context == context) { cached_window = 0; wglMakeCurrent(0, 0); } -- cgit v1.2.3