diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2011-09-27 14:42:41 +0100 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2011-09-27 15:15:05 +0100 |
commit | c369b5bb7bfb557ce92bacc34810b8afe320cc60 (patch) | |
tree | c770b1b9e5c2aa012ded749be32a43de74eee43c /clutter-gst | |
parent | 0e92eac37f76921281a62def7a4f3cbfee0470c8 (diff) | |
download | clutter-gst-c369b5bb7bfb557ce92bacc34810b8afe320cc60.tar.gz |
refactoring: Do not depend on any GL symbol
Since Cogl 1.8.0 we can use cogl_renderer_get_n_fragment_texture_units()
to know the number of texture image units available for fragment
shaders and we can thus avoid using the direct GL call glGetIntegerv and
linking against libGL.
This does not work on OS X though as we can't get the CoglContext out of
the ClutterBackend is that case. Make sure to special case this.
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=657225
Diffstat (limited to 'clutter-gst')
-rw-r--r-- | clutter-gst/Makefile.am | 17 | ||||
-rw-r--r-- | clutter-gst/clutter-gst-video-sink.c | 33 |
2 files changed, 42 insertions, 8 deletions
diff --git a/clutter-gst/Makefile.am b/clutter-gst/Makefile.am index a3f4c44..f75994f 100644 --- a/clutter-gst/Makefile.am +++ b/clutter-gst/Makefile.am @@ -61,13 +61,16 @@ INCLUDES = \ -I$(top_srcdir)/clutter-gst/shaders \ $(NULL) -AM_CPPFLAGS = \ - -DCLUTTER_GST_COMPILATION \ - -DG_DISABLE_DEPRECATED \ - -DG_DISABLE_SINGLE_INCLUDES \ - -DCOGL_DISABLE_DEPRECATED \ - -DCLUTTER_DISABLE_DEPRECATED \ - -DG_LOG_DOMAIN=\"Clutter-Gst\" \ +AM_CPPFLAGS = \ + -DCLUTTER_GST_COMPILATION \ + -DG_DISABLE_DEPRECATED \ + -DG_DISABLE_SINGLE_INCLUDES \ + -DCOGL_DISABLE_DEPRECATED \ + -DCOGL_ENABLE_EXPERIMENTAL_API \ + -DCOGL_ENABLE_EXPERIMENTAL_2_0_API \ + -DCLUTTER_DISABLE_DEPRECATED \ + -DCLUTTER_ENABLE_EXPERIMENTAL_API \ + -DG_LOG_DOMAIN=\"Clutter-Gst\" \ $(NULL) AM_CFLAGS = \ diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c index 3246693..090480a 100644 --- a/clutter-gst/clutter-gst-video-sink.c +++ b/clutter-gst/clutter-gst-video-sink.c @@ -380,6 +380,37 @@ _string_array_to_char_array (char *dst, } #endif +#if defined (HAVE_COGL_1_8) && !defined (HAVE_CLUTTER_OSX) +static gint +get_n_fragment_texture_units (void) +{ + ClutterBackend *backend; + CoglContext *context; + CoglDisplay *display; + CoglRenderer *renderer; + gint n; + + backend = clutter_get_default_backend (); + context = clutter_backend_get_cogl_context (backend); + display = cogl_context_get_display (context); + renderer = cogl_display_get_renderer (display); + + n = cogl_renderer_get_n_fragment_texture_units (renderer); + g_message ("get_n_fragment_texture_units () -> %d", n); + + return n; +} +#else +static gint +get_n_fragment_texture_units (void) +{ + gint n_texture_units; + + glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &n_texture_units); + return n_texture_units; +} +#endif + static CoglHandle _create_cogl_program (const char *source) { @@ -796,7 +827,7 @@ clutter_gst_build_renderers_list (void) NULL }; - glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &nb_texture_units); + nb_texture_units = get_n_fragment_texture_units(); if (nb_texture_units >= 3) features |= CLUTTER_GST_MULTI_TEXTURE; |