[cogl] Add some defines that are missing on GLES



commit 661e1719aa0b95c409c568ec91ea52b8ff90519b
Author: Neil Roberts <neil linux intel com>
Date:   Thu Jan 24 11:41:38 2013 +0000

    Add some defines that are missing on GLES
    
    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 <robert linux intel com>

 cogl/cogl-context.c |    8 +++++++-
 cogl/cogl-texture.c |    5 +++++
 2 files changed, 12 insertions(+), 1 deletions(-)
---
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)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]