diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2014-03-17 23:07:58 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2014-03-17 23:07:58 +0000 |
commit | 12370bd4f8246f72abe75fae90fdee452c7a8f58 (patch) | |
tree | 86b66fda33584a6cc67362d653a96bf31108bbc8 /clutter/clutter-shader-effect.c | |
parent | 115104db8cec7defb010802186430695f0cac77b (diff) | |
download | clutter-12370bd4f8246f72abe75fae90fdee452c7a8f58.tar.gz |
docs: Move to markdown
We're removing docbook tags in favour of the markdown syntax.
Diffstat (limited to 'clutter/clutter-shader-effect.c')
-rw-r--r-- | clutter/clutter-shader-effect.c | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/clutter/clutter-shader-effect.c b/clutter/clutter-shader-effect.c index 95b7d6a7e..a5169782f 100644 --- a/clutter/clutter-shader-effect.c +++ b/clutter/clutter-shader-effect.c @@ -34,35 +34,43 @@ * GLSL shader (after checking whether the compilation and linking were * successfull) to the buffer before painting it on screen. * - * <refsect2 id="ClutterShaderEffect-implementing"> - * <title>Implementing a ClutterShaderEffect</title> - * <para>Creating a sub-class of #ClutterShaderEffect requires the - * overriding of the #ClutterOffscreenEffectClass.paint_target() virtual - * function from the #ClutterOffscreenEffect class as well as the - * <function>get_static_shader_source()</function> virtual from the - * #ClutterShaderEffect class.</para> - * <para>The #ClutterShaderEffectClass.get_static_shader_source() - * function should return a copy of the shader source to use. This - * function is only called once per subclass of #ClutterShaderEffect - * regardless of how many instances of the effect are created. The - * source for the shader is typically stored in a static const - * string which is returned from this function via - * g_strdup().</para> - * <para>The <function>paint_target()</function> should set the - * shader's uniforms if any. This is done by calling - * clutter_shader_effect_set_uniform_value() or - * clutter_shader_effect_set_uniform(). The sub-class should then - * chain up to the #ClutterShaderEffect implementation.</para> - * <example id="ClutterShaderEffect-example-uniforms"> - * <title>Setting uniforms on a ClutterShaderEffect</title> - * <para>The example below shows a typical implementation of the - * <function>get_static_shader_source()</function> and - * <function>paint_target()</function> phases of a - * #ClutterShaderEffect sub-class.</para> - * <programlisting> + * #ClutterShaderEffect is available since Clutter 1.4 + * + * ## Implementing a ClutterShaderEffect + * + * Creating a sub-class of #ClutterShaderEffect requires the + * overriding of the #ClutterOffscreenEffectClass.paint_target() virtual + * function from the #ClutterOffscreenEffect class. It is also convenient + * to implement the #ClutterShaderEffectClass.get_static_shader_source() + * virtual function in case you are planning to create more than one + * instance of the effect. + * + * The #ClutterShaderEffectClass.get_static_shader_source() + * function should return a copy of the shader source to use. This + * function is only called once per subclass of #ClutterShaderEffect + * regardless of how many instances of the effect are created. The + * source for the shader is typically stored in a static const + * string which is returned from this function via + * g_strdup(). + * + * The #ClutterOffscreenEffectClass.paint_target() should set the + * shader's uniforms if any. This is done by calling + * clutter_shader_effect_set_uniform_value() or + * clutter_shader_effect_set_uniform(). The sub-class should then + * chain up to the #ClutterShaderEffect implementation. + * + * ## Setting uniforms on a ClutterShaderEffect + * + * The example below shows a typical implementation of the + * #ClutterShaderEffectClass.get_static_shader_source() and + * #ClutterOffscreenEffectClass.paint_target() virtual functions + * for a #ClutterShaderEffect subclass. + * + * |[<!-- language="C" --> * static gchar * * my_effect_get_static_shader_source (ClutterShaderEffect *effect) * { + * // shader_source is set elsewhere * return g_strdup (shader_source); * } * @@ -74,21 +82,19 @@ * ClutterEffectClass *parent_class; * gfloat component_r, component_g, component_b; * - * /* the "tex" uniform is declared in the shader as: - * * - * * uniform int tex; - * * - * * and it is passed a constant value of 0 - * */ + * // the "tex" uniform is declared in the shader as: + * // + * // uniform int tex; + * // + * // and it is passed a constant value of 0 * clutter_shader_effect_set_uniform (shader, "tex", G_TYPE_INT, 1, 0); * - * /* the "component" uniform is declared in the shader as: - * * - * * uniform vec3 component; - * * - * * and it's defined to contain the normalized components - * * of a #ClutterColor - * */ + * // the "component" uniform is declared in the shader as: + * // + * // uniform vec3 component; + * // + * // and it's defined to contain the normalized components + * // of a #ClutterColor * component_r = self->color.red / 255.0f; * component_g = self->color.green / 255.0f; * component_b = self->color.blue / 255.0f; @@ -98,15 +104,11 @@ * component_g, * component_b); * - * /* chain up to the parent's implementation */ + * // chain up to the parent's implementation * parent_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (my_effect_parent_class); * return parent_class->paint_target (effect); * } - * </programlisting> - * </example> - * </refsect2> - * - * #ClutterShaderEffect is available since Clutter 1.4 + * ]| */ #ifdef HAVE_CONFIG_H @@ -805,7 +807,7 @@ add_uniform: * argument, and by the @gtype argument. For instance, a uniform named * "sampler0" and containing a single integer value is set using: * - * |[ + * |[<!-- language="C" --> * clutter_shader_effect_set_uniform (effect, "sampler0", * G_TYPE_INT, 1, * 0); @@ -814,7 +816,7 @@ add_uniform: * While a uniform named "components" and containing a 3-elements vector * of floating point values (a "vec3") can be set using: * - * |[ + * |[<!-- language="C" --> * gfloat component_r, component_g, component_b; * * clutter_shader_effect_set_uniform (effect, "components", @@ -826,7 +828,7 @@ add_uniform: * * or can be set using: * - * |[ + * |[<!-- language="C" --> * gfloat component_vec[3]; * * clutter_shader_effect_set_uniform (effect, "components", @@ -836,7 +838,7 @@ add_uniform: * * Finally, a uniform named "map" and containing a matrix can be set using: * - * |[ + * |[<!-- language="C" --> * clutter_shader_effect_set_uniform (effect, "map", * CLUTTER_TYPE_SHADER_MATRIX, 1, * cogl_matrix_get_array (&matrix)); |