From 9a242832dccec13b1e756d251bb331b9c2f86e4b Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 24 Jan 2013 11:41:38 +0000 Subject: [PATCH] Add some defines that are missing on GLES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GLES2 driver wasn't compiling unless the GL driver is also enabled because some run-time conditional code was directly using GL-only defines. This should also fix compiling using the stock GL headers on OS X which don't define GL_NUM_EXTENSIONS. https://bugzilla.gnome.org/show_bug.cgi?id=692420 Reviewed-by: Robert Bragg (cherry picked from commit 661e1719aa0b95c409c568ec91ea52b8ff90519b) --- cogl/cogl-context.c | 8 +++++++- cogl/cogl-texture.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c index 6dff50cc1..6e0367345 100644 --- a/cogl/cogl-context.c +++ b/cogl/cogl-context.c @@ -58,11 +58,15 @@ #include "cogl-pipeline-fragend-arbfp-private.h" #endif -/* This isn't defined in the GLES headers */ +/* These aren't defined in the GLES headers */ #ifndef GL_POINT_SPRITE #define GL_POINT_SPRITE 0x8861 #endif +#ifndef GL_NUM_EXTENSIONS +#define GL_NUM_EXTENSIONS 0x821D +#endif + static void _cogl_context_free (CoglContext *context); COGL_OBJECT_DEFINE (Context, context); @@ -649,6 +653,7 @@ _cogl_context_get_gl_extensions (CoglContext *context) /* In GL 3, querying GL_EXTENSIONS is deprecated so we have to build * the array using glGetStringi instead */ +#ifdef HAVE_COGL_GL if (context->driver == COGL_DRIVER_GL3) { int num_extensions, i; @@ -667,6 +672,7 @@ _cogl_context_get_gl_extensions (CoglContext *context) ret[num_extensions] = NULL; } else +#endif { const char *all_extensions = (const char *) context->glGetString (GL_EXTENSIONS); diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index 4ea6eb3e2..eeadd5f87 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -61,6 +61,11 @@ #include #include +/* This isn't defined in the GLES headers */ +#ifndef GL_RED +#define GL_RED 0x1903 +#endif + uint32_t cogl_texture_error_quark (void) {