gl: support cgl, egl and glx within a same build

On osx, with the same build,
gst-launch-1.0 videotestsrc ! glimagesink works with:

GST_GL_PLATFORM=egl GST_GL_WINDOW=x11 GST_GL_API=gles2
GST_GL_PLATFORM=egl GST_GL_WINDOW=x11 GST_GL_API=opengl

GST_GL_PLATFORM=glx GST_GL_WINDOW=x11 GST_GL_API=opengl

GST_GL_PLATFORM=cgl GST_GL_WINDOW=cocoa GST_GL_API=opengl
GST_GL_PLATFORM=cgl GST_GL_WINDOW=cocoa GST_GL_API=opengl3

https://bugzilla.gnome.org/show_bug.cgi?id=752743
This commit is contained in:
Julien Isorce 2015-07-06 00:52:06 +01:00 committed by Tim-Philipp Müller
parent 3bacd64bf1
commit 738ed418ad
2 changed files with 30 additions and 2 deletions

View file

@ -627,7 +627,35 @@ gst_gl_context_egl_get_proc_address (GstGLAPI gl_api, const gchar * name)
gpointer result = NULL;
static GOnce g_once = G_ONCE_INIT;
result = gst_gl_context_default_get_proc_address (gl_api, name);
#ifdef __APPLE__
#if GST_GL_HAVE_OPENGL && !defined(GST_GL_LIBGL_MODULE_NAME)
if (!result && (gl_api & (GST_GL_API_OPENGL | GST_GL_API_OPENGL3))) {
static GModule *module_opengl = NULL;
if (g_once_init_enter (&module_opengl)) {
GModule *setup_module_opengl =
g_module_open ("libGL.dylib", G_MODULE_BIND_LAZY);
g_once_init_leave (&module_opengl, setup_module_opengl);
}
if (module_opengl)
g_module_symbol (module_opengl, name, &result);
}
#endif
#if GST_GL_HAVE_GLES2 && !defined(GST_GL_LIBGLESV2_MODULE_NAME)
if (!result && (gl_api & (GST_GL_API_GLES2))) {
static GModule *module_gles2 = NULL;
if (g_once_init_enter (&module_gles2)) {
GModule *setup_module_gles2 =
g_module_open ("libGLESv2.dylib", G_MODULE_BIND_LAZY);
g_once_init_leave (&module_gles2, setup_module_gles2);
}
if (module_gles2)
g_module_symbol (module_gles2, name, &result);
}
#endif
#endif // __APPLE__
if (!result)
result = gst_gl_context_default_get_proc_address (gl_api, name);
g_once (&g_once, load_egl_module, NULL);

View file

@ -28,7 +28,7 @@
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1
#endif
# ifdef __APPLE__
# ifdef HAVE_IOS
# include <OpenGLES/ES2/gl.h>
# include <OpenGLES/ES2/glext.h>
# else