Class: Clutter::ShaderEffect

Inherits:
OffscreenEffect show all
Defined in:
(unknown)

Overview

The Clutter::ShaderEffectClass structure contains only private data

Instance Method Summary collapse

Methods inherited from OffscreenEffect

#create_texture, #get_target_rect, #get_target_size, #paint_target, #target, #texture

Methods inherited from Effect

#queue_repaint

Methods inherited from ActorMeta

#actor, #actor=, #enabled, #enabled=, #enabled?, #name, #name=

Constructor Details

#initialize(shader_type) ⇒ Clutter::Effect

Creates a new Clutter::ShaderEffect, to be applied to an actor using clutter_actor_add_effect().

The effect will be empty until clutter_shader_effect_set_shader_source() is called.

Parameters:

  • shader_type (Clutter::ShaderType)

    the type of the shader, either %CLUTTER_FRAGMENT_SHADER, or %CLUTTER_VERTEX_SHADER

Instance Method Details

#programCogl::Handle

Retrieves a pointer to the program's handle

Returns:

  • (Cogl::Handle)

    a pointer to the program's handle, or %COGL_INVALID_HANDLE

#set_uniform(name, gtype, n_values, array) ⇒ nil

Sets a list of values as the payload for the uniform name inside the shader effect

The gtype must be one of: %G_TYPE_INT, for 1 or more integer values; %G_TYPE_FLOAT, for 1 or more floating point values; %CLUTTER_TYPE_SHADER_INT, for a pointer to an array of integer values; %CLUTTER_TYPE_SHADER_FLOAT, for a pointer to an array of floating point values; and %CLUTTER_TYPE_SHADER_MATRIX, for a pointer to an array of floating point values mapping a matrix

The number of values interepreted is defined by the n_value argument, and by the gtype argument. For instance, a uniform named "sampler0" and containing a single integer value is set using:

  clutter_shader_effect_set_uniform (effect, "map",
                                     CLUTTER_TYPE_SHADER_MATRIX, 1,
                                     cogl_matrix_get_array (&matrix));

Parameters:

  • name (String)

    the name of the uniform to set

  • gtype (GLib::Type)

    the type of the uniform to set

  • n_values (Integer)

    the number of values

  • array (Array)

    a list of values

Returns:

  • (nil)

#set_uniform_value(name, value) ⇒ nil

Sets value as the payload for the uniform name inside the shader effect

The #GType of the value must be one of: %G_TYPE_INT, for a single integer value; %G_TYPE_FLOAT, for a single floating point value; %CLUTTER_TYPE_SHADER_INT, for an array of integer values; %CLUTTER_TYPE_SHADER_FLOAT, for an array of floating point values; and %CLUTTER_TYPE_SHADER_MATRIX, for a matrix of floating point values. It also accepts %G_TYPE_DOUBLE for compatibility with other languages than C.

Parameters:

  • name (String)

    the name of the uniform to set

  • value (GObject::Value)

    a #GValue with the value of the uniform to set

Returns:

  • (nil)

#shaderCogl::Handle

Retrieves a pointer to the shader's handle

Returns:

  • (Cogl::Handle)

    a pointer to the shader's handle, or %COGL_INVALID_HANDLE

#shader_source=(source) ⇒ Boolean

Sets the source of the GLSL shader used by effect

This function should only be called by implementations of the Clutter::ShaderEffect class, and not by application code.

This function can only be called once; subsequent calls will yield no result.

Parameters:

  • source (String)

    the source of a GLSL shader

Returns:

  • (Boolean)

    true if the source was set

#shader_type=(shader_type) ⇒ Clutter::ShaderType

The type of shader that is used by the effect. This property should be set by the constructor of Clutter::ShaderEffect sub-classes.

Parameters:

Returns: