summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Gl_Window_Driver.H1
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx10
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx8
-rw-r--r--src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx8
4 files changed, 13 insertions, 14 deletions
diff --git a/src/Fl_Gl_Window_Driver.H b/src/Fl_Gl_Window_Driver.H
index ee3332545..d40cbf89e 100644
--- a/src/Fl_Gl_Window_Driver.H
+++ b/src/Fl_Gl_Window_Driver.H
@@ -38,7 +38,6 @@ protected:
GLint current_prog;
Fl_Gl_Window *pWindow;
public:
- static GLContext cached_context;
static Fl_Window* cached_window;
static int nContext;
static GLContext *context_list;
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index b821ae201..5241f2375 100644
--- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -228,8 +228,8 @@ void Fl_Wayland_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context
target_egl_surface = dr->gl_start_support_->egl_surface = eglCreateWindowSurface(
egl_display, wld_egl_conf, dr->gl_start_support_->egl_window, NULL);
}
- if (context != cached_context || w != cached_window) {
- cached_context = context;
+ GLContext current_context = eglGetCurrentContext();
+ if (context != current_context || w != cached_window) {
cached_window = w;
if (eglMakeCurrent(egl_display, target_egl_surface, target_egl_surface,
(EGLContext)context)) {
@@ -259,11 +259,11 @@ void Fl_Wayland_Gl_Window_Driver::apply_scissor() {
void Fl_Wayland_Gl_Window_Driver::delete_gl_context(GLContext context) {
- if (cached_context == context) {
- cached_context = 0;
+ GLContext current_context = eglGetCurrentContext();
+ if (current_context == context) {
cached_window = 0;
}
- if (eglGetCurrentContext() == (EGLContext)context) {
+ if (current_context == (EGLContext)context) {
eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
eglDestroyContext(egl_display, (EGLContext)context);
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);
}
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);
}