Commit 5e4b94c1 authored by Julien Isorce's avatar Julien Isorce

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
parent 45f8a272
...@@ -805,14 +805,14 @@ if test "x$HAVE_GL" = "xyes" -a "x$HAVE_GLES2" = "xyes"; then ...@@ -805,14 +805,14 @@ if test "x$HAVE_GL" = "xyes" -a "x$HAVE_GLES2" = "xyes"; then
#ifndef GL_GLEXT_PROTOTYPES #ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1 #define GL_GLEXT_PROTOTYPES 1
#endif #endif
# ifdef __APPLE__ # ifdef HAVE_IOS
# include <OpenGLES/ES2/gl.h> # include <OpenGLES/ES2/gl.h>
# include <OpenGLES/ES2/glext.h> # include <OpenGLES/ES2/glext.h>
# else # else
# include <GLES2/gl2.h> # include <GLES2/gl2.h>
# include <GLES2/gl2ext.h> # include <GLES2/gl2ext.h>
# endif # endif
# if __APPLE__ # ifdef __APPLE__
# include <OpenGL/OpenGL.h> # include <OpenGL/OpenGL.h>
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 # if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
...@@ -999,12 +999,6 @@ case $host in ...@@ -999,12 +999,6 @@ case $host in
if test "x$NEED_WGL" = "xyes"; then if test "x$NEED_WGL" = "xyes"; then
AC_MSG_ERROR([WGL is not available on Mac OS X]) AC_MSG_ERROR([WGL is not available on Mac OS X])
fi fi
if test "x$NEED_EGL" = "xyes"; then
AC_MSG_ERROR([EGL is not available on Mac OS X])
fi
if test "x$NEED_GLES2" = "xyes"; then
AC_MSG_ERROR([OpenGL|ES 2.0 is not supported on your platform yet])
fi
if test "x$NEED_COCOA" != "xno"; then if test "x$NEED_COCOA" != "xno"; then
GL_LIBS="$LIBS -framework OpenGL -framework Cocoa -framework QuartzCore -framework CoreFoundation" GL_LIBS="$LIBS -framework OpenGL -framework Cocoa -framework QuartzCore -framework CoreFoundation"
...@@ -1030,6 +1024,24 @@ case $host in ...@@ -1030,6 +1024,24 @@ case $host in
USE_OPENGL=yes USE_OPENGL=yes
fi fi
fi fi
if test "x$HAVE_EGL" = "xyes"; then
if test "x$NEED_EGL" != "xno"; then
if test "x$HAVE_WINDOW_X11" = "xyes"; then
GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
USE_EGL=yes
fi
fi
fi
dnl OpenGL|ES 2.0
if test "x$HAVE_GLES2" = "xyes"; then
if test "x$NEED_GLES2" != "xno"; then
GL_LIBS="$GL_LIBS -lGLESv2"
USE_GLES2=yes
fi
fi
fi fi
;; ;;
*-mingw32*) *-mingw32*)
...@@ -1237,7 +1249,7 @@ if test "x$USE_GLES2" = "xyes"; then ...@@ -1237,7 +1249,7 @@ if test "x$USE_GLES2" = "xyes"; then
#ifndef GL_GLEXT_PROTOTYPES #ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1 #define GL_GLEXT_PROTOTYPES 1
#endif #endif
# ifdef __APPLE__ # ifdef HAVE_IOS
# include <OpenGLES/ES2/gl.h> # include <OpenGLES/ES2/gl.h>
# include <OpenGLES/ES2/glext.h> # include <OpenGLES/ES2/glext.h>
# else # else
...@@ -1249,7 +1261,7 @@ fi ...@@ -1249,7 +1261,7 @@ fi
if test "x$USE_OPENGL" = "xyes"; then if test "x$USE_OPENGL" = "xyes"; then
GL_INCLUDES="$GL_INCLUDES GL_INCLUDES="$GL_INCLUDES
# if __APPLE__ # ifdef __APPLE__
# include <OpenGL/OpenGL.h> # include <OpenGL/OpenGL.h>
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
# else # else
......
...@@ -627,6 +627,34 @@ gst_gl_context_egl_get_proc_address (GstGLAPI gl_api, const gchar * name) ...@@ -627,6 +627,34 @@ gst_gl_context_egl_get_proc_address (GstGLAPI gl_api, const gchar * name)
gpointer result = NULL; gpointer result = NULL;
static GOnce g_once = G_ONCE_INIT; static GOnce g_once = G_ONCE_INIT;
#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); result = gst_gl_context_default_get_proc_address (gl_api, name);
g_once (&g_once, load_egl_module, NULL); g_once (&g_once, load_egl_module, NULL);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#ifndef GL_GLEXT_PROTOTYPES #ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1 #define GL_GLEXT_PROTOTYPES 1
#endif #endif
# ifdef __APPLE__ # ifdef HAVE_IOS
# include <OpenGLES/ES2/gl.h> # include <OpenGLES/ES2/gl.h>
# include <OpenGLES/ES2/glext.h> # include <OpenGLES/ES2/glext.h>
# else # else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment