[Cogl] [PATCH 6/6] Don't try to use clip planes on GL3

Neil Roberts neil at linux.intel.com
Fri Dec 14 03:43:32 PST 2012


GL3 has support for clip planes but they are used differently and
involve writing to a builtin output variable in the vertex shader. The
current clip plane code assumes it is only used with a fixed function
driver and tries to directly push to the matrix builtins. This
obviously won't work on GL3 so for now let's just disable clip planes.
---
 cogl/driver/gl/gl/cogl-driver-gl.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/driver/gl/gl/cogl-driver-gl.c
index 845e2fa..2b71ec2 100644
--- a/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -357,7 +357,6 @@ _cogl_driver_update_features (CoglContext *ctx,
 {
   CoglPrivateFeatureFlags private_flags = 0;
   char **gl_extensions;
-  int max_clip_planes = 0;
   int gl_major = 0, gl_minor = 0;
 
   /* We have to special case getting the pointer to the glGetString*
@@ -440,10 +439,6 @@ _cogl_driver_update_features (CoglContext *ctx,
   if (_cogl_check_extension ("GL_MESA_pack_invert", gl_extensions))
     private_flags |= COGL_PRIVATE_FEATURE_MESA_PACK_INVERT;
 
-  GE( ctx, glGetIntegerv (GL_MAX_CLIP_PLANES, &max_clip_planes) );
-  if (max_clip_planes >= 4)
-    private_flags |= COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES;
-
   if (ctx->glGenRenderbuffers)
     {
       COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_OFFSCREEN, TRUE);
@@ -548,11 +543,19 @@ _cogl_driver_update_features (CoglContext *ctx,
     private_flags |= COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE;
 
   if (ctx->driver == COGL_DRIVER_GL)
-    /* Features which are not available in GL 3 */
-    private_flags |= (COGL_PRIVATE_FEATURE_FIXED_FUNCTION |
-                      COGL_PRIVATE_FEATURE_ALPHA_TEST |
-                      COGL_PRIVATE_FEATURE_QUADS |
-                      COGL_PRIVATE_FEATURE_ALPHA_TEXTURES);
+    {
+      int max_clip_planes = 0;
+
+      /* Features which are not available in GL 3 */
+      private_flags |= (COGL_PRIVATE_FEATURE_FIXED_FUNCTION |
+                        COGL_PRIVATE_FEATURE_ALPHA_TEST |
+                        COGL_PRIVATE_FEATURE_QUADS |
+                        COGL_PRIVATE_FEATURE_ALPHA_TEXTURES);
+
+      GE( ctx, glGetIntegerv (GL_MAX_CLIP_PLANES, &max_clip_planes) );
+      if (max_clip_planes >= 4)
+        private_flags |= COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES;
+    }
 
   private_flags |= (COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT |
                     COGL_PRIVATE_FEATURE_ANY_GL |
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list