Next: , Previous: ClutterScript, Up: Top


33 ClutterShader

Programmable pipeline abstraction

33.1 Overview

<clutter-shader> is an object providing an abstraction over the OpenGL programmable pipeline. By using <clutter-shader>s is possible to override the drawing pipeline by using small programs also known as "shaders".

<clutter-shader> is available since Clutter 0.6

33.2 Usage

— Class: <clutter-shader>

Derives from <gobject>.

This class defines the following slots:

vertex-source
Source of vertex shader
fragment-source
Source of fragment shader
compiled
Whether the shader is compiled and linked
enabled
Whether the shader is enabled
— Function: clutter-shader-new   (ret <clutter-shader>)

Create a new <clutter-shader> instance.

ret
a new <clutter-shader>.

Since 0.6

— Function: clutter-shader-set-vertex-source (self <clutter-shader>) (data mchars) (length ssize_t)
— Method: set-vertex-source

Sets the GLSL source code to be used by a <clutter-shader> for the vertex program.

shader
a <clutter-shader>
data
GLSL source code.
length
length of source buffer (currently ignored)

Since 0.6

— Function: clutter-shader-get-vertex-source (self <clutter-shader>)   (ret mchars)
— Method: get-vertex-source

Query the current GLSL vertex source set on shader.

shader
a <clutter-shader>
ret
the source of the vertex shader for this ClutterShader object or ‘#f’. The returned string is owned by the shader object and should never be modified or freed

Since 0.6

— Function: clutter-shader-set-fragment-source (self <clutter-shader>) (data mchars) (length ssize_t)
— Method: set-fragment-source

Sets the GLSL source code to be used by a <clutter-shader> for the fragment program.

shader
a <clutter-shader>
data
GLSL source code.
length
length of source buffer (currently ignored)

Since 0.6

— Function: clutter-shader-get-fragment-source (self <clutter-shader>)   (ret mchars)
— Method: get-fragment-source

Query the current GLSL fragment source set on shader.

shader
a <clutter-shader>
ret
the source of the fragment shader for this ClutterShader object or ‘#f’. The returned string is owned by the shader object and should never be modified or freed

Since 0.6

— Function: clutter-shader-compile (self <clutter-shader>)   (ret bool)
— Method: compile

Compiles and links GLSL sources set for vertex and fragment shaders for a <clutter-shader>. If the compilation fails and a <g-error> return location is provided the error will contain the errors from the compiler, if any.

shader
a <clutter-shader>
error
return location for a <g-error>, or ‘#f
ret
returns TRUE if the shader was succesfully compiled.

Since 0.8

— Function: clutter-shader-release (self <clutter-shader>)
— Method: release

Frees up any GL context resources held by the shader.

shader
a <clutter-shader>

Since 0.6

— Function: clutter-shader-is-compiled (self <clutter-shader>)   (ret bool)
— Method: is-compiled

Checks whether shader is is currently compiled, linked and bound to the GL context.

shader
a <clutter-shader>
ret
#t’ if the shader is compiled, linked and ready for use.

Since 0.8

— Function: clutter-shader-set-is-enabled (self <clutter-shader>) (enabled bool)
— Method: set-is-enabled

Enables a shader. This function will attempt to compile and link the shader, if it isn't already.

When enabled is ‘#f’ the default state of the GL pipeline will be used instead.

shader
a <clutter-shader>
enabled
The new state of the shader.

Since 0.6

— Function: clutter-shader-get-is-enabled (self <clutter-shader>)   (ret bool)
— Method: get-is-enabled

Checks whether shader is enabled.

shader
a <clutter-shader>
ret
#t’ if the shader is enabled.

Since 0.6

— Function: clutter-shader-set-uniform-1f (self <clutter-shader>) (name mchars) (value float)
— Method: set-uniform-1f

Sets a user configurable variable in the shader programs attached to a <clutter-shader>.

shader
a <clutter-shader>
name
name of uniform in vertex or fragment program to set.
value
the new value of the uniform.

Since 0.6