[Cogl] [PATCH 3/4] Add some defines that are missing on GLES

Neil Roberts neil at linux.intel.com
Thu Jan 24 04:09:52 PST 2013


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
---
 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 45834e1..ea2b1c0 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -57,11 +57,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);
@@ -569,6 +573,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;
@@ -587,6 +592,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 e1a305b..4c8e718 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -59,6 +59,11 @@
 #include <stdlib.h>
 #include <math.h>
 
+/* This isn't defined in the GLES headers */
+#ifndef GL_RED
+#define GL_RED 0x1903
+#endif
+
 uint32_t
 cogl_texture_error_domain (void)
 {
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list