From 427fff032eaedaf4489633d6a775413343b878a6 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Sat, 24 Jan 2009 15:09:43 +0000 Subject: [PATCH] Removes cogl_blend_func and cogl_alpha_func The GL blend function and alpha function are now controlled by the material code, and even internally Cogl should now be using the material API when it needs control of these. --- README | 3 +++ clutter/cogl/cogl.h.in | 13 ------------- clutter/cogl/common/cogl-material.c | 8 ++++++++ clutter/cogl/gl/cogl-context.c | 3 --- clutter/cogl/gl/cogl-context.h | 2 -- clutter/cogl/gl/cogl.c | 24 ------------------------ clutter/cogl/gles/cogl.c | 24 ------------------------ 7 files changed, 11 insertions(+), 66 deletions(-) diff --git a/README b/README index c179fae8c..222c28cc3 100644 --- a/README +++ b/README @@ -248,6 +248,9 @@ Release Notes for Clutter 1.0 * A CoglMesh type and utility API has been added; this is currently used to support describing texture matrices. +* cogl_alpha_func has been removed, since this is now controlled using the + material API via cogl_material_set_alpha_test_function () + Release Notes for Clutter 0.8 ------------------------------- diff --git a/clutter/cogl/cogl.h.in b/clutter/cogl/cogl.h.in index e0cf44a82..ff35f33d6 100644 --- a/clutter/cogl/cogl.h.in +++ b/clutter/cogl/cogl.h.in @@ -405,19 +405,6 @@ void cogl_enable_depth_test (gboolean setting); */ void cogl_enable_backface_culling (gboolean setting); -/** - * cogl_alpha_func: - * @func: the comparison function to use, one of CGL_NEVER, CGL_LESS, - * CGL_EQUAL, CGL_LEQUAL, CGL_GREATER, CGL_NOTEQUAL, CGL_GEQUAL and GL_ALWAYS. - * @ref: reference value. - * - * Changes the alpha test to use the specified function specified in @func, - * comparing with the value in @ref. The default function is CGL_ALWAYS the - * initial reference value is 1.0. - */ -void cogl_alpha_func (COGLenum func, - float ref); - /** * cogl_fog_set: * @fog_color: The color of the fog diff --git a/clutter/cogl/common/cogl-material.c b/clutter/cogl/common/cogl-material.c index 0b4b9dc6b..5b3c7490e 100644 --- a/clutter/cogl/common/cogl-material.c +++ b/clutter/cogl/common/cogl-material.c @@ -13,6 +13,14 @@ #include #include +/* + * GL/GLES compatability defines for material thingies: + */ + +#ifdef HAVE_COGL_GLES2 +#define glAlphaFunc cogl_wrap_glAlphaFunc +#endif + static void _cogl_material_free (CoglMaterial *tex); static void _cogl_material_layer_free (CoglMaterialLayer *layer); diff --git a/clutter/cogl/gl/cogl-context.c b/clutter/cogl/gl/cogl-context.c index 6a3c032e4..252f3d294 100644 --- a/clutter/cogl/gl/cogl-context.c +++ b/clutter/cogl/gl/cogl-context.c @@ -81,9 +81,6 @@ cogl_create_context () _context->fbo_handles = NULL; _context->draw_buffer = COGL_WINDOW_BUFFER; - _context->blend_src_factor = CGL_SRC_ALPHA; - _context->blend_dst_factor = CGL_ONE_MINUS_SRC_ALPHA; - _context->shader_handles = NULL; _context->program_handles = NULL; diff --git a/clutter/cogl/gl/cogl-context.h b/clutter/cogl/gl/cogl-context.h index db3a333a1..2f0dd0817 100644 --- a/clutter/cogl/gl/cogl-context.h +++ b/clutter/cogl/gl/cogl-context.h @@ -45,8 +45,6 @@ typedef struct /* Enable cache */ gulong enable_flags; guint8 color_alpha; - COGLenum blend_src_factor; - COGLenum blend_dst_factor; gboolean enable_backface_culling; diff --git a/clutter/cogl/gl/cogl.c b/clutter/cogl/gl/cogl.c index 3568493b9..47358502d 100644 --- a/clutter/cogl/gl/cogl.c +++ b/clutter/cogl/gl/cogl.c @@ -315,23 +315,6 @@ cogl_get_enable () return ctx->enable_flags; } -void -cogl_blend_func (COGLenum src_factor, COGLenum dst_factor) -{ - /* This function caches the blending setup in the - * hope of lessening GL traffic. - */ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - if (ctx->blend_src_factor != src_factor || - ctx->blend_dst_factor != dst_factor) - { - glBlendFunc (src_factor, dst_factor); - ctx->blend_src_factor = src_factor; - ctx->blend_dst_factor = dst_factor; - } -} - void cogl_enable_depth_test (gboolean setting) { @@ -577,13 +560,6 @@ _cogl_disable_clip_planes (void) GE( glDisable (GL_CLIP_PLANE0) ); } -void -cogl_alpha_func (COGLenum func, - float ref) -{ - GE( glAlphaFunc (func, (ref)) ); -} - void cogl_perspective (float fovy, float aspect, diff --git a/clutter/cogl/gles/cogl.c b/clutter/cogl/gles/cogl.c index 717b1e13f..373072d28 100644 --- a/clutter/cogl/gles/cogl.c +++ b/clutter/cogl/gles/cogl.c @@ -229,23 +229,6 @@ cogl_get_enable () return ctx->enable_flags; } -void -cogl_blend_func (COGLenum src_factor, COGLenum dst_factor) -{ - /* This function caches the blending setup in the - * hope of lessening GL traffic. - */ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - if (ctx->blend_src_factor != src_factor || - ctx->blend_dst_factor != dst_factor) - { - glBlendFunc (src_factor, dst_factor); - ctx->blend_src_factor = src_factor; - ctx->blend_dst_factor = dst_factor; - } -} - void cogl_enable_depth_test (gboolean setting) { @@ -498,13 +481,6 @@ _cogl_disable_clip_planes (void) GE( cogl_wrap_glDisable (GL_CLIP_PLANE0) ); } -void -cogl_alpha_func (COGLenum func, - float ref) -{ - GE( cogl_wrap_glAlphaFunc (func, (ref)) ); -} - /* * Fixed point implementation of the perspective function */