[mutter] MetaBackgroundActor: add a setter for GLSL uniforms
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MetaBackgroundActor: add a setter for GLSL uniforms
- Date: Mon, 19 Nov 2012 19:19:31 +0000 (UTC)
commit e73946f0bf0ba6a77cf48ce2bd9e1bd12dfb6ff2
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Wed Nov 7 19:00:25 2012 +0100
MetaBackgroundActor: add a setter for GLSL uniforms
It doesn't make sense to GLSL shaders without uniforms.
https://bugzilla.gnome.org/show_bug.cgi?id=682536
src/compositor/meta-background-actor.c | 35 ++++++++++++++++++++++++++++++++
src/meta/meta-background-actor.h | 7 ++++++
2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index 0f5840d..b039b58 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -668,3 +668,38 @@ meta_background_actor_add_glsl_snippet (MetaBackgroundActor *actor,
cogl_object_unref (snippet);
}
+/**
+ * meta_background_actor_set_uniform_float:
+ * @actor: a #MetaBackgroundActor
+ * @uniform_name:
+ * @n_components: number of components (for vector uniforms)
+ * @count: number of uniforms (for array uniforms)
+ * @uniform: (array length=uniform_length): the float values to set
+ * @uniform_length: the length of @uniform. Must be exactly @n_components x @count,
+ * and is provided mainly for language bindings.
+ *
+ * Sets a new GLSL uniform to the provided value. This is mostly
+ * useful in congiunction with meta_background_actor_add_glsl_snippet().
+ */
+
+void
+meta_background_actor_set_uniform_float (MetaBackgroundActor *actor,
+ const char *uniform_name,
+ int n_components,
+ int count,
+ const float *uniform,
+ int uniform_length)
+{
+ MetaBackgroundActorPrivate *priv;
+
+ g_return_if_fail (META_IS_BACKGROUND_ACTOR (actor));
+ g_return_if_fail (uniform_length == n_components * count);
+
+ priv = actor->priv;
+
+ cogl_pipeline_set_uniform_float (priv->pipeline,
+ cogl_pipeline_get_uniform_location (priv->pipeline,
+ uniform_name),
+ n_components, count, uniform);
+}
+
diff --git a/src/meta/meta-background-actor.h b/src/meta/meta-background-actor.h
index 6efcc25..71831af 100644
--- a/src/meta/meta-background-actor.h
+++ b/src/meta/meta-background-actor.h
@@ -90,4 +90,11 @@ void meta_background_actor_add_glsl_snippet (MetaBackgroundActor *actor,
const char *code,
gboolean is_replace);
+void meta_background_actor_set_uniform_float (MetaBackgroundActor *actor,
+ const char *uniform_name,
+ int n_components,
+ int count,
+ const float *uniform,
+ int uniform_length);
+
#endif /* META_BACKGROUND_ACTOR_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]