summaryrefslogtreecommitdiff
path: root/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-01-29 14:01:41 +0100
committerMatthias Melcher <github@matthiasm.com>2024-01-29 14:01:41 +0100
commitfaff63130c90461d7e077be68a40a716257be12d (patch)
tree15ae77eb7279af23704b7db671a30ac18657b8ae /src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
parentc40b1653532aa08412aa8232fb8a11289512283e (diff)
Fix cached GL context on all platforms (#737)
Diffstat (limited to 'src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx')
-rw-r--r--src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx8
1 files changed, 4 insertions, 4 deletions
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);
}