Clutter 0.8.2 Reference Manual | ||||
---|---|---|---|---|
enum ClutterShaderError; ClutterShader; ClutterShaderClass; ClutterShader* clutter_shader_new (void); void clutter_shader_set_vertex_source (ClutterShader *shader, const gchar *data, gssize length); const gchar* clutter_shader_get_vertex_source (ClutterShader *shader); void clutter_shader_set_fragment_source (ClutterShader *shader, const gchar *data, gssize length); const gchar* clutter_shader_get_fragment_source (ClutterShader *shader); gboolean clutter_shader_compile (ClutterShader *shader, GError **error); void clutter_shader_release (ClutterShader *shader); gboolean clutter_shader_is_compiled (ClutterShader *shader); void clutter_shader_set_is_enabled (ClutterShader *shader, gboolean enabled); gboolean clutter_shader_get_is_enabled (ClutterShader *shader); void clutter_shader_set_uniform_1f (ClutterShader *shader, const gchar *name, gfloat value);
"compiled" gboolean : Read "enabled" gboolean : Read / Write "fragment-source" gchar* : Read / Write "vertex-source" gchar* : Read / Write
ClutterShader is an object providing an abstraction over the OpenGL programmable pipeline. By using ClutterShaders is possible to override the drawing pipeline by using small programs also known as "shaders".
ClutterShader is available since Clutter 0.6
typedef enum { CLUTTER_SHADER_ERROR_NO_ASM, CLUTTER_SHADER_ERROR_NO_GLSL, CLUTTER_SHADER_ERROR_COMPILE } ClutterShaderError;
ClutterShader error enumeration
No ASM shaders support | |
No GLSL shaders support | |
Compilation error |
Since 0.6
ClutterShader* clutter_shader_new (void);
Create a new ClutterShader instance.
Returns : |
a new ClutterShader. |
Since 0.6
void clutter_shader_set_vertex_source (ClutterShader *shader, const gchar *data, gssize length);
Sets the GLSL source code to be used by a ClutterShader for the vertex program.
|
a ClutterShader |
|
GLSL source code. |
|
length of source buffer (currently ignored) |
Since 0.6
const gchar* clutter_shader_get_vertex_source (ClutterShader *shader);
Query the current GLSL vertex source set on shader
.
|
a ClutterShader |
Returns : |
the source of the vertex shader for this
ClutterShader object or NULL . The returned string is owned by the
shader object and should never be modified or freed
|
Since 0.6
void clutter_shader_set_fragment_source (ClutterShader *shader, const gchar *data, gssize length);
Sets the GLSL source code to be used by a ClutterShader for the fragment program.
|
a ClutterShader |
|
GLSL source code. |
|
length of source buffer (currently ignored) |
Since 0.6
const gchar* clutter_shader_get_fragment_source (ClutterShader *shader);
Query the current GLSL fragment source set on shader
.
|
a ClutterShader |
Returns : |
the source of the fragment shader for this
ClutterShader object or NULL . The returned string is owned by the
shader object and should never be modified or freed
|
Since 0.6
gboolean clutter_shader_compile (ClutterShader *shader, GError **error);
Compiles and links GLSL sources set for vertex and fragment shaders for a ClutterShader. If the compilation fails and a GError return location is provided the error will contain the errors from the compiler, if any.
|
a ClutterShader |
|
return location for a GError, or NULL
|
Returns : |
returns TRUE if the shader was succesfully compiled. |
Since 0.8
void clutter_shader_release (ClutterShader *shader);
Frees up any GL context resources held by the shader.
|
a ClutterShader |
Since 0.6
gboolean clutter_shader_is_compiled (ClutterShader *shader);
Checks whether shader
is is currently compiled, linked and bound
to the GL context.
|
a ClutterShader |
Returns : |
TRUE if the shader is compiled, linked and ready for use.
|
Since 0.8
void clutter_shader_set_is_enabled (ClutterShader *shader, gboolean enabled);
Enables a shader. This function will attempt to compile and link the shader, if it isn't already.
When enabled
is FALSE
the default state of the GL pipeline will be
used instead.
|
a ClutterShader |
|
The new state of the shader. |
Since 0.6
gboolean clutter_shader_get_is_enabled (ClutterShader *shader);
Checks whether shader
is enabled.
|
a ClutterShader |
Returns : |
TRUE if the shader is enabled.
|
Since 0.6
void clutter_shader_set_uniform_1f (ClutterShader *shader, const gchar *name, gfloat value);
Sets a user configurable variable in the shader programs attached to a ClutterShader.
|
a ClutterShader |
|
name of uniform in vertex or fragment program to set. |
|
the new value of the uniform. |
Since 0.6
"compiled"
property"compiled" gboolean : Read
Whether the shader is compiled and linked, ready for use in the GL context.
Default value: FALSE
Since 0.8
"enabled"
property"enabled" gboolean : Read / Write
Whether the shader is currently used in the GL rendering pipeline.
Default value: FALSE
Since 0.6
"fragment-source"
property"fragment-source" gchar* : Read / Write
GLSL source code for the fragment shader part of the shader program.
Default value: NULL
Since 0.6
"vertex-source"
property"vertex-source" gchar* : Read / Write
GLSL source code for the vertex shader part of the shader program, if any.
Default value: NULL
Since 0.6