cogl-material: Fallback to BlendFunc if BlendFuncSeparate is unavailable
authorNeil Roberts <neil@linux.intel.com>
Wed, 11 Nov 2009 13:38:52 +0000 (13:38 +0000)
committerNeil Roberts <neil@linux.intel.com>
Fri, 13 Nov 2009 15:55:55 +0000 (15:55 +0000)
glBlendFuncSeparate is only available in OpenGL 1.4. If we
conditionally check for this then Clutter will work with OpenGL 1.2.

http://bugzilla.openedhand.com/show_bug.cgi?id=1875

clutter/cogl/cogl/cogl-material.c

index a050e1a..7ac8340 100644 (file)
@@ -1546,16 +1546,21 @@ _cogl_material_flush_base_gl_state (CoglMaterial *material,
     {
 #if defined (HAVE_COGL_GLES2)
       gboolean have_blend_equation_seperate = TRUE;
+      gboolean have_blend_func_separate = TRUE;
 #elif defined (HAVE_COGL_GL)
       gboolean have_blend_equation_seperate = FALSE;
+      gboolean have_blend_func_separate = FALSE;
       if (ctx->drv.pf_glBlendEquationSeparate) /* Only GL 2.0 + */
         have_blend_equation_seperate = TRUE;
+      if (ctx->drv.pf_glBlendFuncSeparate) /* Only GL 1.4 + */
+        have_blend_func_separate = TRUE;
 #endif
 
 #ifndef HAVE_COGL_GLES /* GLES 1 only has glBlendFunc */
-      if (material->blend_src_factor_rgb != material->blend_src_factor_alpha
-          || (material->blend_src_factor_rgb !=
-              material->blend_src_factor_alpha))
+      if (have_blend_func_separate &&
+          (material->blend_src_factor_rgb != material->blend_src_factor_alpha ||
+           (material->blend_src_factor_rgb !=
+            material->blend_src_factor_alpha)))
         {
           if (have_blend_equation_seperate &&
               material->blend_equation_rgb != material->blend_equation_alpha)