]> git.sesse.net Git - movit/commitdiff
Make get_current_context_identifier() understand EGL.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 5 Oct 2015 23:24:26 +0000 (01:24 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 5 Oct 2015 23:24:26 +0000 (01:24 +0200)
If we're using EGL and not GLX (typically because we're using GLES,
but also increasingly with desktop GL), we'd always return NULL.
This could FBOs to be confused between contexts.

util.cpp

index c2ac59301778906894410cb27971ea4956289e56..3f59edfbce359e752eaa7786fdd6e10636052c36 100644 (file)
--- a/util.cpp
+++ b/util.cpp
@@ -19,6 +19,7 @@
 #include <epoxy/wgl.h>
 #else
 #include <epoxy/glx.h>
+#include <epoxy/egl.h>
 #endif
 
 using namespace std;
@@ -331,7 +332,11 @@ void *get_gl_context_identifier()
 #elif defined(WIN32)
        return (void *)wglGetCurrentContext();
 #else
-       return (void *)glXGetCurrentContext();
+       void *ret = (void *)glXGetCurrentContext();
+       if (ret != NULL) {
+               return ret;
+       }
+       return (void *)eglGetCurrentContext();
 #endif
 }