From 605243d95285ad57cf55dc7674884f3ed4b09524 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 26 May 2009 16:55:11 +0100 Subject: [PATCH] [cogl] renamed cogl_enable_* to cogl_set_*_enabled + added getters cogl_enable_depth_test and cogl_enable_backface_culling have been renamed and now have corresponding getters, the new functions are: cogl_set_depth_test_enabled cogl_get_depth_test_enabled cogl_set_backface_culling_enabled cogl_get_backface_culling_enabled --- README | 3 +++ clutter/cogl/cogl-deprecated.h | 1 + clutter/cogl/cogl.h.in | 27 +++++++++++++++++++++++---- clutter/cogl/common/cogl.c | 25 +++++++++++++++++-------- doc/reference/cogl/cogl-sections.txt | 6 ++++-- tests/conform/test-backface-culling.c | 4 ++-- 6 files changed, 50 insertions(+), 16 deletions(-) diff --git a/README b/README index e28a467f3..97521a4b3 100644 --- a/README +++ b/README @@ -333,6 +333,9 @@ Release Notes for Clutter 1.0 * cogl_shader_get_parameteriv has been replaced by cogl_shader_get_type and cogl_shader_is_compiled. More getters can be added later if desired. +* cogl_enable_depth_test has been renamed to cogl_set_depth_test_enabled and + a corresponding cogl_get_depth_test_enabled function has been added. + Release Notes for Clutter 0.8 ------------------------------- diff --git a/clutter/cogl/cogl-deprecated.h b/clutter/cogl/cogl-deprecated.h index 2111e48b4..41e77b3d6 100644 --- a/clutter/cogl/cogl-deprecated.h +++ b/clutter/cogl/cogl-deprecated.h @@ -24,5 +24,6 @@ #ifndef COGL_DEPRECATED_H #define cogl_color cogl_color_REPLACED_BY_cogl_set_source_color +#define cogl_enable_depth_test cogl_enable_depth_test_RENAMED_TO_cogl_set_depth_test_enabled #endif diff --git a/clutter/cogl/cogl.h.in b/clutter/cogl/cogl.h.in index e66cbc394..188af09cd 100644 --- a/clutter/cogl/cogl.h.in +++ b/clutter/cogl/cogl.h.in @@ -331,7 +331,7 @@ void cogl_set_projection_matrix (CoglMatrix *matrix); void cogl_get_viewport (float v[4]); /** - * cogl_enable_depth_test: + * cogl_set_depth_test_enable: * @setting: %TRUE to enable depth testing or %FALSE to disable. * * Sets whether depth testing is enabled. If it is disabled then the @@ -340,10 +340,19 @@ void cogl_get_viewport (float v[4]); * clutter_actor_lower(), otherwise it will also take into account the * actor's depth. Depth testing is disabled by default. */ -void cogl_enable_depth_test (gboolean setting); +void cogl_set_depth_test_enable (gboolean setting); /** - * cogl_enable_backface_culling: + * cogl_get_depth_test_enable: + * + * Queries if depth testing has been enabled via cogl_set_depth_test_enable() + * + * Returns: TRUE if depth testing is enabled else FALSE + */ +gboolean cogl_get_depth_test_enable (void); + +/** + * cogl_set_backface_culling_enabled: * @setting: %TRUE to enable backface culling or %FALSE to disable. * * Sets whether textures positioned so that their backface is showing @@ -352,7 +361,17 @@ void cogl_enable_depth_test (gboolean setting); * only affects calls to the cogl_rectangle* family of functions and * cogl_vertex_buffer_draw*. Backface culling is disabled by default. */ -void cogl_enable_backface_culling (gboolean setting); +void cogl_set_backface_culling_enabled (gboolean setting); + +/** + * cogl_get_backface_culling_enabled: + * + * Queries if backface culling has been enabled via + * cogl_set_backface_culling_enabled() + * + * Returns: TRUE if backface culling is enabled else FALSE + */ +gboolean cogl_get_backface_culling_enabled (void); /** * cogl_set_fog: diff --git a/clutter/cogl/common/cogl.c b/clutter/cogl/common/cogl.c index 81c43bd5e..adeb479d2 100644 --- a/clutter/cogl/common/cogl.c +++ b/clutter/cogl/common/cogl.c @@ -214,30 +214,39 @@ cogl_get_enable () } void -cogl_enable_depth_test (gboolean setting) +cogl_set_depth_test_enabled (gboolean setting) { if (setting) { glEnable (GL_DEPTH_TEST); - glEnable (GL_ALPHA_TEST); glDepthFunc (GL_LEQUAL); - glAlphaFunc (GL_GREATER, 0.1); } else - { - glDisable (GL_DEPTH_TEST); - glDisable (GL_ALPHA_TEST); - } + glDisable (GL_DEPTH_TEST); +} + +gboolean +cogl_get_depth_test_enabled (void) +{ + return glIsEnabled (GL_DEPTH_TEST) == GL_TRUE ? TRUE : FALSE; } void -cogl_enable_backface_culling (gboolean setting) +cogl_set_backface_culling_enabled (gboolean setting) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); ctx->enable_backface_culling = setting; } +gboolean +cogl_get_backface_culling_enabled (void) +{ + _COGL_GET_CONTEXT (ctx, FALSE); + + return ctx->enable_backface_culling; +} + void cogl_set_source_color (const CoglColor *color) { diff --git a/doc/reference/cogl/cogl-sections.txt b/doc/reference/cogl/cogl-sections.txt index 5855a90b1..c34585ff1 100644 --- a/doc/reference/cogl/cogl-sections.txt +++ b/doc/reference/cogl/cogl-sections.txt @@ -40,8 +40,10 @@ cogl_get_viewport cogl_clear cogl_get_bitmasks -cogl_enable_depth_test -cogl_enable_backface_culling +cogl_set_depth_test_enabled +cogl_get_depth_test_enabled +cogl_set_backface_culling_enabled +cogl_get_backface_culling_enabled CoglFogMode cogl_set_fog diff --git a/tests/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c index 00f36bfba..bfddcf105 100644 --- a/tests/conform/test-backface-culling.c +++ b/tests/conform/test-backface-culling.c @@ -108,7 +108,7 @@ on_paint (ClutterActor *actor, TestState *state) int i; int frame_num; - cogl_enable_backface_culling (TRUE); + cogl_set_backface_culling_enabled (TRUE); cogl_push_matrix (); @@ -180,7 +180,7 @@ on_paint (ClutterActor *actor, TestState *state) /* The second time round draw beneath the first with backface culling disabled */ cogl_translate (0, TEXTURE_RENDER_SIZE, 0); - cogl_enable_backface_culling (FALSE); + cogl_set_backface_culling_enabled (FALSE); } cogl_pop_matrix ();