[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
This commit is contained in:
Robert Bragg 2009-05-26 16:55:11 +01:00
parent 96188bab62
commit 605243d952
6 changed files with 50 additions and 16 deletions

3
README
View File

@ -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
-------------------------------

View File

@ -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

View File

@ -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:

View File

@ -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);
}
}
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)
{

View File

@ -40,8 +40,10 @@ cogl_get_viewport
<SUBSECTION>
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
<SUBSECTION>
CoglFogMode
cogl_set_fog

View File

@ -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 ();