2008-02-01 Matthew Allum <mallum@openedhand.com>

* 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.
This commit is contained in:
Matthew Allum 2008-02-01 18:14:54 +00:00
parent b14da429e0
commit d83442476f
4 changed files with 53 additions and 19 deletions

View File

@ -1,3 +1,18 @@
2008-02-01 Matthew Allum <mallum@openedhand.com>
* 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 <mallum@openedhand.com> 2008-02-01 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-texture.c: (clutter_texture_new_from_actor): * clutter/clutter-texture.c: (clutter_texture_new_from_actor):

View File

@ -118,6 +118,9 @@ cogl_clip_unset (void);
void void
cogl_enable (gulong flags); cogl_enable (gulong flags);
void
cogl_enable_depth_test (gboolean setting);
gboolean gboolean
cogl_texture_can_size (COGLenum target, cogl_texture_can_size (COGLenum target,
COGLenum pixel_format, COGLenum pixel_format,

View File

@ -200,8 +200,19 @@ cogl_paint_init (const ClutterColor *color)
glDisable (GL_LIGHTING); glDisable (GL_LIGHTING);
glDisable (GL_FOG); 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); cogl_enable (CGL_ENABLE_BLEND);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
@ -308,22 +319,23 @@ cogl_enable (gulong flags)
__enable_flags &= ~CGL_ENABLE_TEXTURE_RECT; __enable_flags &= ~CGL_ENABLE_TEXTURE_RECT;
} }
#endif #endif
}
#if 0 void
if (flags & CGL_ENABLE_ALPHA_TEST) cogl_enable_depth_test (gboolean setting)
{ {
if (!(__enable_flags & CGL_ENABLE_ALPHA_TEST)) if (setting)
{ {
glEnable (GL_DEPTH_TEST);
glEnable (GL_ALPHA_TEST); glEnable (GL_ALPHA_TEST);
__enable_flags |= CGL_ENABLE_ALPHA_TEST; glDepthFunc (GL_LEQUAL);
glAlphaFunc (GL_GREATER, 0.1);
} }
} else
else if (__enable_flags & CGL_ENABLE_ALPHA_TEST)
{ {
glDisable (GL_DEPTH_TEST);
glDisable (GL_ALPHA_TEST); glDisable (GL_ALPHA_TEST);
__enable_flags &= ~CGL_ENABLE_ALPHA_TEST;
} }
#endif
} }
void void

View File

@ -224,18 +224,22 @@ cogl_enable (gulong flags)
__enable_flags &= ~CGL_ENABLE_TEXTURE_RECT; __enable_flags &= ~CGL_ENABLE_TEXTURE_RECT;
} }
#endif #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_DEPTH_TEST);
glEnable (GL_ALPHA_TEST); glEnable (GL_ALPHA_TEST);
glDepthFunc (GL_LEQUAL);
__enable_flags |= CGL_ENABLE_ALPHA_TEST; glAlphaFunc (GL_GREATER, 0.1);
} }
else if (__enable_flags & CGL_ENABLE_ALPHA_TEST) else
{ {
glDisable (GL_DEPTH_TEST);
glDisable (GL_ALPHA_TEST); glDisable (GL_ALPHA_TEST);
__enable_flags &= ~CGL_ENABLE_ALPHA_TEST;
} }
} }