[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 18193e5322
commit 2f0bda49fc
4 changed files with 45 additions and 14 deletions

View File

@ -24,5 +24,6 @@
#ifndef COGL_DEPRECATED_H #ifndef COGL_DEPRECATED_H
#define cogl_color cogl_color_REPLACED_BY_cogl_set_source_color #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 #endif

View File

@ -331,7 +331,7 @@ void cogl_set_projection_matrix (CoglMatrix *matrix);
void cogl_get_viewport (float v[4]); 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. * @setting: %TRUE to enable depth testing or %FALSE to disable.
* *
* Sets whether depth testing is enabled. If it is disabled then the * 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 * clutter_actor_lower(), otherwise it will also take into account the
* actor's depth. Depth testing is disabled by default. * 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. * @setting: %TRUE to enable backface culling or %FALSE to disable.
* *
* Sets whether textures positioned so that their backface is showing * 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 * only affects calls to the cogl_rectangle* family of functions and
* cogl_vertex_buffer_draw*. Backface culling is disabled by default. * 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: * cogl_set_fog:

View File

@ -214,30 +214,39 @@ cogl_get_enable ()
} }
void void
cogl_enable_depth_test (gboolean setting) cogl_set_depth_test_enabled (gboolean setting)
{ {
if (setting) if (setting)
{ {
glEnable (GL_DEPTH_TEST); glEnable (GL_DEPTH_TEST);
glEnable (GL_ALPHA_TEST);
glDepthFunc (GL_LEQUAL); glDepthFunc (GL_LEQUAL);
glAlphaFunc (GL_GREATER, 0.1);
} }
else else
{
glDisable (GL_DEPTH_TEST); 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 void
cogl_enable_backface_culling (gboolean setting) cogl_set_backface_culling_enabled (gboolean setting)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
ctx->enable_backface_culling = setting; ctx->enable_backface_culling = setting;
} }
gboolean
cogl_get_backface_culling_enabled (void)
{
_COGL_GET_CONTEXT (ctx, FALSE);
return ctx->enable_backface_culling;
}
void void
cogl_set_source_color (const CoglColor *color) cogl_set_source_color (const CoglColor *color)
{ {

View File

@ -40,8 +40,10 @@ cogl_get_viewport
<SUBSECTION> <SUBSECTION>
cogl_clear cogl_clear
cogl_get_bitmasks cogl_get_bitmasks
cogl_enable_depth_test cogl_set_depth_test_enabled
cogl_enable_backface_culling cogl_get_depth_test_enabled
cogl_set_backface_culling_enabled
cogl_get_backface_culling_enabled
<SUBSECTION> <SUBSECTION>
CoglFogMode CoglFogMode
cogl_set_fog cogl_set_fog