mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
* clutter/clutter-actor.[ch]: added clutter_actor_get_shader and
renamed clutter_actor_apply_shader to be clutter_actor_set_shader. Reindented/aligned header. * clutter/clutter-texture.c: (clutter_texture_paint): temporarily disable the shader on top of the clutter context's shader stack while rendering into the FBO. * tests/test-fbo.c: (main): s/apply_shader/set_shader/ * tests/test-shader.c: (button_release_cb), (main): s/apply_shader/set_shader/
This commit is contained in:
parent
680cd23b43
commit
1fe08217b7
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2008-02-04 Øyvind Kolås <pippin@o-hand.com>
|
||||||
|
|
||||||
|
* clutter/clutter-actor.[ch]: added clutter_actor_get_shader and
|
||||||
|
renamed clutter_actor_apply_shader to be clutter_actor_set_shader.
|
||||||
|
Reindented/aligned header.
|
||||||
|
* clutter/clutter-texture.c: (clutter_texture_paint): temporarily
|
||||||
|
disable the shader on top of the clutter context's shader stack while
|
||||||
|
rendering into the FBO.
|
||||||
|
* tests/test-fbo.c: (main): s/apply_shader/set_shader/
|
||||||
|
* tests/test-shader.c: (button_release_cb), (main):
|
||||||
|
s/apply_shader/set_shader/
|
||||||
|
|
||||||
2008-02-03 Matthew Allum <mallum@openedhand.com>
|
2008-02-03 Matthew Allum <mallum@openedhand.com>
|
||||||
|
|
||||||
* clutter/clutter-actor.c: (clutter_actor_set_rotationx):
|
* clutter/clutter-actor.c: (clutter_actor_set_rotationx):
|
||||||
|
@ -5027,19 +5027,50 @@ destroy_shader_data (ClutterActor *self)
|
|||||||
actor_priv->shader_data = NULL;
|
actor_priv->shader_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_actor_apply_shader:
|
* clutter_actor_get_shader:
|
||||||
* @self: a #ClutterActor
|
* @self: a #ClutterActor
|
||||||
* @shader: a #ClutterShader or %NULL
|
* @shader: a #ClutterShader or %NULL
|
||||||
*
|
*
|
||||||
* Sets the #ClutterShader to be applied on @self.
|
* Queries the currently set #ClutterShader on @self.
|
||||||
|
*
|
||||||
|
* Return value: The currently set #ClutterShader or NULL if no shader is set.
|
||||||
|
*
|
||||||
|
* Since: 0.6
|
||||||
|
*/
|
||||||
|
ClutterShader *
|
||||||
|
clutter_actor_get_shader (ClutterActor *self)
|
||||||
|
{
|
||||||
|
ClutterActorPrivate *actor_priv;
|
||||||
|
ShaderData *shader_data;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||||
|
|
||||||
|
actor_priv = self->priv;
|
||||||
|
shader_data = actor_priv->shader_data;
|
||||||
|
|
||||||
|
if (!shader_data)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return shader_data->shader;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_actor_set_shader:
|
||||||
|
* @self: a #ClutterActor
|
||||||
|
* @shader: a #ClutterShader or %NULL to unset the shader.
|
||||||
|
*
|
||||||
|
* Sets the #ClutterShader to be used when rendering @self, pass in NULL
|
||||||
|
* to unset a currently set shader for an actor.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the shader was successfully applied
|
* Return value: %TRUE if the shader was successfully applied
|
||||||
*
|
*
|
||||||
* Since: 0.6
|
* Since: 0.6
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
clutter_actor_apply_shader (ClutterActor *self,
|
clutter_actor_set_shader (ClutterActor *self,
|
||||||
ClutterShader *shader)
|
ClutterShader *shader)
|
||||||
{
|
{
|
||||||
ClutterActorPrivate *actor_priv;
|
ClutterActorPrivate *actor_priv;
|
||||||
@ -5048,6 +5079,12 @@ clutter_actor_apply_shader (ClutterActor *self,
|
|||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||||
g_return_val_if_fail (shader == NULL || CLUTTER_IS_SHADER (shader), FALSE);
|
g_return_val_if_fail (shader == NULL || CLUTTER_IS_SHADER (shader), FALSE);
|
||||||
|
|
||||||
|
/* if shader passed in is NULL we destroy the shader */
|
||||||
|
if (shader == NULL)
|
||||||
|
{
|
||||||
|
destroy_shader_data (self);
|
||||||
|
}
|
||||||
|
|
||||||
actor_priv = self->priv;
|
actor_priv = self->priv;
|
||||||
shader_data = actor_priv->shader_data;
|
shader_data = actor_priv->shader_data;
|
||||||
|
|
||||||
@ -5066,13 +5103,17 @@ clutter_actor_apply_shader (ClutterActor *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shader)
|
if (shader)
|
||||||
|
{
|
||||||
shader_data->shader = g_object_ref (shader);
|
shader_data->shader = g_object_ref (shader);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
clutter_actor_queue_redraw (self);
|
clutter_actor_queue_redraw (self);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_each_param (gpointer key,
|
set_each_param (gpointer key,
|
||||||
gpointer value,
|
gpointer value,
|
||||||
|
@ -419,13 +419,13 @@ ClutterActor * clutter_get_actor_by_gid (guint32 id);
|
|||||||
|
|
||||||
gboolean clutter_actor_should_pick_paint (ClutterActor *self);
|
gboolean clutter_actor_should_pick_paint (ClutterActor *self);
|
||||||
|
|
||||||
gboolean clutter_actor_apply_shader (ClutterActor *self,
|
gboolean clutter_actor_set_shader (ClutterActor *self,
|
||||||
ClutterShader *shader);
|
ClutterShader *shader);
|
||||||
|
ClutterShader * clutter_actor_get_shader (ClutterActor *self);
|
||||||
void clutter_actor_set_shader_param (ClutterActor *self,
|
void clutter_actor_set_shader_param (ClutterActor *self,
|
||||||
const gchar *param,
|
const gchar *param,
|
||||||
gfloat value);
|
gfloat value);
|
||||||
|
|
||||||
|
|
||||||
void clutter_actor_set_anchor_point (ClutterActor *self,
|
void clutter_actor_set_anchor_point (ClutterActor *self,
|
||||||
gint anchor_x,
|
gint anchor_x,
|
||||||
gint anchor_y);
|
gint anchor_y);
|
||||||
|
@ -762,6 +762,19 @@ clutter_texture_paint (ClutterActor *self)
|
|||||||
|
|
||||||
if (priv->fbo_handle)
|
if (priv->fbo_handle)
|
||||||
{
|
{
|
||||||
|
ClutterMainContext *context;
|
||||||
|
|
||||||
|
context = clutter_context_get_default ();
|
||||||
|
|
||||||
|
/* Temporarily turn of the shader on the top of the context's
|
||||||
|
* shader stack, to restore the GL pipeline to it's natural state.
|
||||||
|
*/
|
||||||
|
if (context->shaders)
|
||||||
|
{
|
||||||
|
clutter_shader_set_is_enabled (
|
||||||
|
clutter_actor_get_shader (context->shaders->data), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
cogl_offscreen_redirect_start (priv->fbo_handle,
|
cogl_offscreen_redirect_start (priv->fbo_handle,
|
||||||
priv->width, priv->height);
|
priv->width, priv->height);
|
||||||
clutter_actor_paint (priv->fbo_source);
|
clutter_actor_paint (priv->fbo_source);
|
||||||
@ -770,6 +783,13 @@ clutter_texture_paint (ClutterActor *self)
|
|||||||
CLUTTER_STAGE_HEIGHT());
|
CLUTTER_STAGE_HEIGHT());
|
||||||
|
|
||||||
glBindTexture(CGL_TEXTURE_RECTANGLE_ARB, priv->tiles[0]);
|
glBindTexture(CGL_TEXTURE_RECTANGLE_ARB, priv->tiles[0]);
|
||||||
|
|
||||||
|
/* If there is a shader on top of the shader stack, turn it back on. */
|
||||||
|
if (context->shaders)
|
||||||
|
{
|
||||||
|
clutter_shader_set_is_enabled (
|
||||||
|
clutter_actor_get_shader (context->shaders->data), TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ main (gint argc,
|
|||||||
|
|
||||||
/* apply a shader to it */
|
/* apply a shader to it */
|
||||||
shader = make_shader();
|
shader = make_shader();
|
||||||
clutter_actor_apply_shader (fbo, shader);
|
clutter_actor_set_shader (fbo, shader);
|
||||||
clutter_actor_set_shader_param (fbo, "radius", 2.0);
|
clutter_actor_set_shader_param (fbo, "radius", 2.0);
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,11 +173,12 @@ button_release_cb (ClutterActor *actor,
|
|||||||
shader_no, shaders[shader_no].name,
|
shader_no, shaders[shader_no].name,
|
||||||
error->message);
|
error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
clutter_actor_apply_shader (actor, NULL);
|
clutter_actor_set_shader (actor, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clutter_actor_apply_shader (actor, shader);
|
clutter_actor_set_shader (actor, NULL);
|
||||||
|
clutter_actor_set_shader (actor, shader);
|
||||||
clutter_actor_set_shader_param (actor, "radius", 3.0);
|
clutter_actor_set_shader_param (actor, "radius", 3.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,7 +263,7 @@ main (gint argc,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
clutter_actor_apply_shader (actor, shader);
|
clutter_actor_set_shader (actor, shader);
|
||||||
clutter_actor_set_position (actor, 100, 100);
|
clutter_actor_set_position (actor, 100, 100);
|
||||||
|
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
|
||||||
|
Loading…
Reference in New Issue
Block a user