From d83442476f0c5c0daed4a180bd91cba56012f1ab Mon Sep 17 00:00:00 2001 From: Matthew Allum Date: Fri, 1 Feb 2008 18:14:54 +0000 Subject: [PATCH] 2008-02-01 Matthew Allum * clutter/cogl/cogl.h: * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Disable the depth test and buffer as has some strange side effects, mainly on x/y axis rotation with multiple layers at same depth (eg rotating text on a bg has very strange effect). Seems no clean 100% effective way to fix without other odd issues.. So for now move to application to handle and add cogl_enable_depth_test() as for custom actors (i.e groups) to enable if need be. --- ChangeLog | 15 +++++++++++++++ clutter/cogl/cogl.h | 3 +++ clutter/cogl/gl/cogl.c | 36 ++++++++++++++++++++++++------------ clutter/cogl/gles/cogl.c | 18 +++++++++++------- 4 files changed, 53 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ad1b5779..1d0ce371a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-02-01 Matthew Allum + + * clutter/cogl/cogl.h: + * clutter/cogl/gl/cogl.c: (cogl_paint_init), (cogl_enable): + * clutter/cogl/gles/cogl.c: (cogl_enable): + + Disable the depth test and buffer as has some strange side + effects, mainly on x/y axis rotation with multiple layers at + same depth (eg rotating text on a bg has very strange + effect). Seems no clean 100% effective way to fix without other + odd issues.. So for now move to application to handle and add + cogl_enable_depth_test() as for custom actors (i.e groups) to + enable if need be. + + 2008-02-01 Matthew Allum * clutter/clutter-texture.c: (clutter_texture_new_from_actor): diff --git a/clutter/cogl/cogl.h b/clutter/cogl/cogl.h index c03717226..beb2955d7 100644 --- a/clutter/cogl/cogl.h +++ b/clutter/cogl/cogl.h @@ -118,6 +118,9 @@ cogl_clip_unset (void); void cogl_enable (gulong flags); +void +cogl_enable_depth_test (gboolean setting); + gboolean cogl_texture_can_size (COGLenum target, COGLenum pixel_format, diff --git a/clutter/cogl/gl/cogl.c b/clutter/cogl/gl/cogl.c index 25f1f1da8..02f8e4e4b 100644 --- a/clutter/cogl/gl/cogl.c +++ b/clutter/cogl/gl/cogl.c @@ -200,8 +200,19 @@ cogl_paint_init (const ClutterColor *color) glDisable (GL_LIGHTING); glDisable (GL_FOG); - glEnable (GL_DEPTH_TEST); - glDepthFunc (GL_LEQUAL); + /* + * Disable the depth test for now as has some strange side effects, + * mainly on x/y axis rotation with multiple layers at same depth + * (eg rotating text on a bg has very strange effect). Seems no clean + * 100% effective way to fix without other odd issues.. So for now + * move to application to handle and add cogl_enable_depth_test() + * as for custom actors (i.e groups) to enable if need be. + * + * glEnable (GL_DEPTH_TEST); + * glEnable (GL_ALPHA_TEST) + * glDepthFunc (GL_LEQUAL); + * glAlphaFunc (GL_GREATER, 0.1); + */ cogl_enable (CGL_ENABLE_BLEND); glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -308,22 +319,23 @@ cogl_enable (gulong flags) __enable_flags &= ~CGL_ENABLE_TEXTURE_RECT; } #endif +} -#if 0 - if (flags & CGL_ENABLE_ALPHA_TEST) +void +cogl_enable_depth_test (gboolean setting) +{ + if (setting) { - if (!(__enable_flags & CGL_ENABLE_ALPHA_TEST)) - { - glEnable (GL_ALPHA_TEST); - __enable_flags |= CGL_ENABLE_ALPHA_TEST; - } + glEnable (GL_DEPTH_TEST); + glEnable (GL_ALPHA_TEST); + glDepthFunc (GL_LEQUAL); + glAlphaFunc (GL_GREATER, 0.1); } - else if (__enable_flags & CGL_ENABLE_ALPHA_TEST) + else { + glDisable (GL_DEPTH_TEST); glDisable (GL_ALPHA_TEST); - __enable_flags &= ~CGL_ENABLE_ALPHA_TEST; } -#endif } void diff --git a/clutter/cogl/gles/cogl.c b/clutter/cogl/gles/cogl.c index f972dc922..c80547fe5 100644 --- a/clutter/cogl/gles/cogl.c +++ b/clutter/cogl/gles/cogl.c @@ -224,18 +224,22 @@ cogl_enable (gulong flags) __enable_flags &= ~CGL_ENABLE_TEXTURE_RECT; } #endif +} - if (flags & CGL_ENABLE_ALPHA_TEST) +void +cogl_enable_depth_test (gboolean setting) +{ + if (setting) { - if (!(__enable_flags & CGL_ENABLE_ALPHA_TEST)) - glEnable (GL_ALPHA_TEST); - - __enable_flags |= CGL_ENABLE_ALPHA_TEST; + glEnable (GL_DEPTH_TEST); + glEnable (GL_ALPHA_TEST); + glDepthFunc (GL_LEQUAL); + glAlphaFunc (GL_GREATER, 0.1); } - else if (__enable_flags & CGL_ENABLE_ALPHA_TEST) + else { + glDisable (GL_DEPTH_TEST); glDisable (GL_ALPHA_TEST); - __enable_flags &= ~CGL_ENABLE_ALPHA_TEST; } }