[material] fix _set_alpha_test_function: missing a glEnable(GL_ALPHA_TEST)
authorRobert Bragg <robert@linux.intel.com>
Fri, 25 Sep 2009 18:04:13 +0000 (19:04 +0100)
committerRobert Bragg <robert@linux.intel.com>
Fri, 28 May 2010 14:35:23 +0000 (15:35 +0100)
Since the default alpha test function of GL_ALWAYS is equivalent to
GL_ALPHA_TEST being disabled we don't need to worry about Enabling/Disabling
it when flushing material state, instead it's enough to leave it always
enabled.  We will assume that any driver worth its salt wont incur any
additional cost for glEnable (GL_ALPHA_TEST) + GL_ALWAYS vs
glDisable (GL_ALPHA_TEST).

This patch simply calls glEnable (GL_ALPHA_TEST) in cogl_create_context

clutter/cogl/cogl/cogl-context.c

index 4f3cb66..871f6dd 100644 (file)
@@ -123,6 +123,12 @@ cogl_create_context (void)
 
   _context->texture_download_material = COGL_INVALID_HANDLE;
 
+  /* The default for GL_ALPHA_TEST is to always pass which is equivalent to
+   * the test being disabled therefore we assume that for all drivers there
+   * will be no performance impact if we always leave the test enabled which
+   * makes things a bit simpler for us. */
+  GE (glEnable (GL_ALPHA_TEST));
+
   /* Create default textures used for fall backs */
   _context->default_gl_texture_2d_tex =
     cogl_texture_new_from_data (1, /* width */