## GstGLShader

GstGLShader — object representing an OpenGL shader program

## Functions

GstGLShader * | gst_gl_shader_new ()
GstGLShader * | gst_gl_shader_new_default ()
GstGLShader * | gst_gl_shader_new_link_with_stages ()
GstGLShader * | gst_gl_shader_new_with_stages ()
void | gst_gl_shader_use ()
void | gst_gl_context_clear_shader ()
int | gst_gl_shader_get_program_handle ()
void | gst_gl_shader_release ()
void | gst_gl_shader_release_unlocked ()
gboolean | gst_gl_shader_attach ()
gboolean | gst_gl_shader_attach_unlocked ()
gboolean | gst_gl_shader_compile_attach_stage ()
void | gst_gl_shader_detach ()
void | gst_gl_shader_detach_unlocked ()
gboolean | gst_gl_shader_is_linked ()
gboolean | gst_gl_shader_link ()
void | gst_gl_shader_set_uniform_1i ()
void | gst_gl_shader_set_uniform_1f ()
void | gst_gl_shader_set_uniform_1fv ()
void | gst_gl_shader_set_uniform_1iv ()
void | gst_gl_shader_set_uniform_2f ()
void | gst_gl_shader_set_uniform_2fv ()
void | gst_gl_shader_set_uniform_2i ()
void | gst_gl_shader_set_uniform_2iv ()
void | gst_gl_shader_set_uniform_3f ()
void | gst_gl_shader_set_uniform_3fv ()
void | gst_gl_shader_set_uniform_3i ()
void | gst_gl_shader_set_uniform_3iv ()
void | gst_gl_shader_set_uniform_4f ()
void | gst_gl_shader_set_uniform_4fv ()
void | gst_gl_shader_set_uniform_4i ()
void | gst_gl_shader_set_uniform_4iv ()
void | gst_gl_shader_set_uniform_matrix_2fv ()
void | gst_gl_shader_set_uniform_matrix_2x3fv ()
void | gst_gl_shader_set_uniform_matrix_2x4fv ()
void | gst_gl_shader_set_uniform_matrix_3fv ()
void | gst_gl_shader_set_uniform_matrix_3x2fv ()
void | gst_gl_shader_set_uniform_matrix_3x4fv ()
void | gst_gl_shader_set_uniform_matrix_4fv ()
void | gst_gl_shader_set_uniform_matrix_4x2fv ()
void | gst_gl_shader_set_uniform_matrix_4x3fv ()
gint | gst_gl_shader_get_attribute_location ()
void | gst_gl_shader_bind_attribute_location ()
void | gst_gl_shader_bind_frag_data_location ()

## Properties

gboolean | linked | Read

## Types and Values

| GstGLShader

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstGLShader

## Includes

    #include <gst/gl/gl.h>

## Description

## Functions

### gst_gl_shader_new ()

    GstGLShader *
    gst_gl_shader_new (GstGLContext *context);

Note: must be called in the GL thread

#### Parameters

context | a GstGLContext |

#### Returns

a new empty `shader` .

[transfer full]

### gst_gl_shader_new_default ()

    GstGLShader *
    gst_gl_shader_new_default (GstGLContext *context,
                               GError **error);

Note: must be called in the GL thread

#### Parameters

context | a GstGLContext |
error | a GError that is filled on failure |

#### Returns

a default `shader` or `NULL` on failure.

[transfer full]

Since: 1.8

### gst_gl_shader_new_link_with_stages ()

    GstGLShader *
    gst_gl_shader_new_link_with_stages (GstGLContext *context,
                                        GError **error,
                                        ...);

Each stage will attempt to be compiled and attached to `shader` . Then the shader will be linked. On error, `NULL` will be returned and `error` will contain the details of the error.

Note: must be called in the GL thread

#### Parameters

context | a GstGLContext |
error | a GError |
... | a NULL terminated list of GstGLSLStage's |

#### Returns

a new `shader` with the specified stages.

[transfer full]

Since: 1.8

### gst_gl_shader_new_with_stages ()

    GstGLShader *
    gst_gl_shader_new_with_stages (GstGLContext *context,
                                   GError **error,
                                   ...);

Each stage will attempt to be compiled and attached to `shader` . On error, `NULL` will be returned and `error` will contain the details of the error.

Note: must be called in the GL thread

#### Parameters

context | a GstGLContext |
error | a GError |
... | a NULL terminated list of GstGLSLStage's |

#### Returns

a new `shader` with the specified stages.

[transfer full]

Since: 1.8

### gst_gl_shader_use ()

    void
    gst_gl_shader_use (GstGLShader *shader);

Mark's `shader` as being used for the next GL draw command.

Note: must be called in the GL thread and `shader` must have been linked.

#### Parameters

shader | a GstGLShader |

### gst_gl_context_clear_shader ()

    void
    gst_gl_context_clear_shader (GstGLContext *context);

Clear's the currently set shader from the GL state machine.

Note: must be called in the GL thread.

#### Parameters

context | a GstGLContext |

### gst_gl_shader_get_program_handle ()

    int
    gst_gl_shader_get_program_handle (GstGLShader *shader);

#### Parameters

shader | a GstGLShader |

#### Returns

the GL program handle for this shader

Since: 1.8

### gst_gl_shader_release ()

    void
    gst_gl_shader_release (GstGLShader *shader);

Releases the shader and stages.

Note: must be called in the GL thread

#### Parameters

shader | a GstGLShader |

Since: 1.8

### gst_gl_shader_release_unlocked ()

    void
    gst_gl_shader_release_unlocked (GstGLShader *shader);

Releases the shader and stages.

Note: must be called in the GL thread

#### Parameters

shader | a GstGLShader |

Since: 1.8

### gst_gl_shader_attach ()

    gboolean
    gst_gl_shader_attach (GstGLShader *shader,
                          GstGLSLStage *stage);

Attaches `stage` to `shader` . `stage` must have been successfully compiled with `gst_glsl_stage_compile()`.

Note: must be called in the GL thread

#### Parameters

shader | a GstGLShader |
stage | a GstGLSLStage to attach. | [transfer floating]

#### Returns

whether `stage` could be attached to `shader`

Since: 1.8

### gst_gl_shader_attach_unlocked ()

    gboolean
    gst_gl_shader_attach_unlocked (GstGLShader *shader,
                                   GstGLSLStage *stage);

Attaches `stage` to `shader` . `stage` must have been successfully compiled with `gst_glsl_stage_compile()`.

Note: must be called in the GL thread

#### Parameters

shader | a GstGLShader |
stage | a GstGLSLStage to attach. | [transfer floating]

#### Returns

whether `stage` could be attached to `shader`

Since: 1.8

### gst_gl_shader_compile_attach_stage ()

    gboolean
    gst_gl_shader_compile_attach_stage (GstGLShader *shader,
                                        GstGLSLStage *stage,
                                        GError **error);

Compiles `stage` and attaches it to `shader` .

Note: must be called in the GL thread

#### Parameters

shader | a GstGLShader |
stage | a GstGLSLStage to attach |
error | a GError |

#### Returns

whether `stage` could be compiled and attached to `shader`

Since: 1.8

### gst_gl_shader_detach ()

    void
    gst_gl_shader_detach (GstGLShader *shader,
                          GstGLSLStage *stage);

Detaches `stage` from `shader` . `stage` must have been successfully attached to `shader` with `gst_gl_shader_attach()` or `gst_gl_shader_attach_unlocked()`.

Note: must be called in the GL thread

#### Parameters

shader | a GstGLShader |
stage | a GstGLSLStage to attach |

Since: 1.8

### gst_gl_shader_detach_unlocked ()

    void
    gst_gl_shader_detach_unlocked (GstGLShader *shader,
                                   GstGLSLStage *stage);

Detaches `stage` from `shader` . `stage` must have been successfully attached to `shader` with `gst_gl_shader_attach()` or `gst_gl_shader_attach_unlocked()`.

Note: must be called in the GL thread

#### Parameters

shader | a GstGLShader |
stage | a GstGLSLStage to attach |

Since: 1.8

### gst_gl_shader_is_linked ()

    gboolean
    gst_gl_shader_is_linked (GstGLShader *shader);

Note: must be called in the GL thread

#### Parameters

shader | a GstGLShader |

#### Returns

whether `shader` has been successfully linked

Since: 1.8

### gst_gl_shader_link ()

    gboolean
    gst_gl_shader_link (GstGLShader *shader,
                        GError **error);

Links the current list of GstGLSLStage's in `shader` .

Note: must be called in the GL thread

#### Parameters

shader | a GstGLShader |
error | a GError |

#### Returns

whether `shader` could be linked together.

Since: 1.8

### gst_gl_shader_set_uniform_1i ()

    void
    gst_gl_shader_set_uniform_1i (GstGLShader *shader,
                                  const gchar *name,
                                  gint value);

Perform `glUniform1i()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
value | value to set |

### gst_gl_shader_set_uniform_1f ()

    void
    gst_gl_shader_set_uniform_1f (GstGLShader *shader,
                                  const gchar *name,
                                  gfloat value);

Perform `glUniform1f()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
value | value to set |

### gst_gl_shader_set_uniform_1fv ()

    void
    gst_gl_shader_set_uniform_1fv (GstGLShader *shader,
                                   const gchar *name,
                                   guint count,
                                   const gfloat *value);

Perform `glUniform1fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of values to set |
value | values to set. | [array length=count]

### gst_gl_shader_set_uniform_1iv ()

    void
    gst_gl_shader_set_uniform_1iv (GstGLShader *shader,
                                   const gchar *name,
                                   guint count,
                                   const gint *value);

Perform `glUniform1iv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of values to set |
value | values to set. | [array length=count]

### gst_gl_shader_set_uniform_2f ()

    void
    gst_gl_shader_set_uniform_2f (GstGLShader *shader,
                                  const gchar *name,
                                  gfloat v0,
                                  gfloat v1);

Perform `glUniform2f()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
v0 | first value to set |
v1 | second value to set |

### gst_gl_shader_set_uniform_2fv ()

    void
    gst_gl_shader_set_uniform_2fv (GstGLShader *shader,
                                   const gchar *name,
                                   guint count,
                                   const gfloat *value);

Perform `glUniform2fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of values to set |
value | values to set. | [array length=count]

### gst_gl_shader_set_uniform_2i ()

    void
    gst_gl_shader_set_uniform_2i (GstGLShader *shader,
                                  const gchar *name,
                                  gint v0,
                                  gint v1);

Perform `glUniform2i()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
v0 | first value to set |
v1 | second value to set |

### gst_gl_shader_set_uniform_2iv ()

    void
    gst_gl_shader_set_uniform_2iv (GstGLShader *shader,
                                   const gchar *name,
                                   guint count,
                                   const gint *value);

Perform `glUniform2iv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of values to set |
value | values to set. | [array length=count]

### gst_gl_shader_set_uniform_3f ()

    void
    gst_gl_shader_set_uniform_3f (GstGLShader *shader,
                                  const gchar *name,
                                  gfloat v0,
                                  gfloat v1,
                                  gfloat v2);

Perform `glUniform3f()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
v0 | first value to set |
v1 | second value to set |
v2 | third value to set |

### gst_gl_shader_set_uniform_3fv ()

    void
    gst_gl_shader_set_uniform_3fv (GstGLShader *shader,
                                   const gchar *name,
                                   guint count,
                                   const gfloat *value);

Perform `glUniform3fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of values to set |
value | values to set. | [array length=count]

### gst_gl_shader_set_uniform_3i ()

    void
    gst_gl_shader_set_uniform_3i (GstGLShader *shader,
                                  const gchar *name,
                                  gint v0,
                                  gint v1,
                                  gint v2);

Perform `glUniform3i()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
v0 | first value to set |
v1 | second value to set |
v2 | third value to set |

### gst_gl_shader_set_uniform_3iv ()

    void
    gst_gl_shader_set_uniform_3iv (GstGLShader *shader,
                                   const gchar *name,
                                   guint count,
                                   const gint *value);

Perform `glUniform3iv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of values to set |
value | values to set. | [array length=count]

### gst_gl_shader_set_uniform_4f ()

    void
    gst_gl_shader_set_uniform_4f (GstGLShader *shader,
                                  const gchar *name,
                                  gfloat v0,
                                  gfloat v1,
                                  gfloat v2,
                                  gfloat v3);

Perform `glUniform4f()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
v0 | first value to set |
v1 | second value to set |
v2 | third value to set |
v3 | fourth value to set |

### gst_gl_shader_set_uniform_4fv ()

    void
    gst_gl_shader_set_uniform_4fv (GstGLShader *shader,
                                   const gchar *name,
                                   guint count,
                                   const gfloat *value);

Perform `glUniform4fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of values to set |
value | values to set. | [array length=count]

### gst_gl_shader_set_uniform_4i ()

    void
    gst_gl_shader_set_uniform_4i (GstGLShader *shader,
                                  const gchar *name,
                                  gint v0,
                                  gint v1,
                                  gint v2,
                                  gint v3);

Perform `glUniform4i()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
v0 | first value to set |
v1 | second value to set |
v2 | third value to set |
v3 | fourth value to set |

### gst_gl_shader_set_uniform_4iv ()

    void
    gst_gl_shader_set_uniform_4iv (GstGLShader *shader,
                                   const gchar *name,
                                   guint count,
                                   const gint *value);

Perform `glUniform4iv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of values to set |
value | values to set. | [array length=count]

### gst_gl_shader_set_uniform_matrix_2fv ()

    void
    gst_gl_shader_set_uniform_matrix_2fv (GstGLShader *shader,
                                          const gchar *name,
                                          gint count,
                                          gboolean transpose,
                                          const gfloat *value);

Perform `glUniformMatrix2fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of 2x2 matrices to set |
transpose | transpose the matrix |
value | matrix to set |

### gst_gl_shader_set_uniform_matrix_2x3fv ()

    void
    gst_gl_shader_set_uniform_matrix_2x3fv
                                   (GstGLShader *shader,
                                    const gchar *name,
                                    gint count,
                                    gboolean transpose,
                                    const gfloat *value);

Perform `glUniformMatrix2x3fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of 2x3 matrices to set |
transpose | transpose the matrix |
value | values to set |

### gst_gl_shader_set_uniform_matrix_2x4fv ()

    void
    gst_gl_shader_set_uniform_matrix_2x4fv
                                   (GstGLShader *shader,
                                    const gchar *name,
                                    gint count,
                                    gboolean transpose,
                                    const gfloat *value);

Perform `glUniformMatrix2x4fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of 2x4 matrices to set |
transpose | transpose the matrix |
value | values to set |

### gst_gl_shader_set_uniform_matrix_3fv ()

    void
    gst_gl_shader_set_uniform_matrix_3fv (GstGLShader *shader,
                                          const gchar *name,
                                          gint count,
                                          gboolean transpose,
                                          const gfloat *value);

Perform `glUniformMatrix3fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of 3x3 matrices to set |
transpose | transpose the matrix |
value | values to set |

### gst_gl_shader_set_uniform_matrix_3x2fv ()

    void
    gst_gl_shader_set_uniform_matrix_3x2fv
                                   (GstGLShader *shader,
                                    const gchar *name,
                                    gint count,
                                    gboolean transpose,
                                    const gfloat *value);

Perform `glUniformMatrix3x2fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of 3x2 matrices to set |
transpose | transpose the matrix |
value | values to set |

### gst_gl_shader_set_uniform_matrix_3x4fv ()

    void
    gst_gl_shader_set_uniform_matrix_3x4fv
                                   (GstGLShader *shader,
                                    const gchar *name,
                                    gint count,
                                    gboolean transpose,
                                    const gfloat *value);

Perform `glUniformMatrix3x4fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of 3x4 matrices to set |
transpose | transpose the matrix |
value | values to set |

### gst_gl_shader_set_uniform_matrix_4fv ()

    void
    gst_gl_shader_set_uniform_matrix_4fv (GstGLShader *shader,
                                          const gchar *name,
                                          gint count,
                                          gboolean transpose,
                                          const gfloat *value);

Perform `glUniformMatrix4fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of 4x4 matrices to set |
transpose | transpose the matrix |
value | values to set |

### gst_gl_shader_set_uniform_matrix_4x2fv ()

    void
    gst_gl_shader_set_uniform_matrix_4x2fv
                                   (GstGLShader *shader,
                                    const gchar *name,
                                    gint count,
                                    gboolean transpose,
                                    const gfloat *value);

Perform `glUniformMatrix4x2fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of 4x2 matrices to set |
transpose | transpose the matrix |
value | values to set |

### gst_gl_shader_set_uniform_matrix_4x3fv ()

    void
    gst_gl_shader_set_uniform_matrix_4x3fv
                                   (GstGLShader *shader,
                                    const gchar *name,
                                    gint count,
                                    gboolean transpose,
                                    const gfloat *value);

Perform `glUniformMatrix4x3fv()` for `name` on `shader`

#### Parameters

shader | a GstGLShader |
name | name of the uniform |
count | number of 4x3 matrices to set |
transpose | transpose the matrix |
value | values to set |

### gst_gl_shader_get_attribute_location ()

    gint
    gst_gl_shader_get_attribute_location (GstGLShader *shader,
                                          const gchar *name);

#### Parameters

shader | a GstGLShader |
name | name of the attribute |

#### Returns

the attribute index for `name` in `shader` or -1 on failure

### gst_gl_shader_bind_attribute_location ()

    void
    gst_gl_shader_bind_attribute_location (GstGLShader *shader,
                                           guint index,
                                           const gchar *name);

Bind attribute `name` to the specified location `index` using `glBindAttributeLocation()`.

#### Parameters

shader | a GstGLShader |
index | attribute index to set |
name | name of the attribute |

### gst_gl_shader_bind_frag_data_location ()

    void
    gst_gl_shader_bind_frag_data_location (GstGLShader *shader,
                                           guint index,
                                           const gchar *name);

Bind attribute `name` to the specified location `index` using `glBindFragDataLocation()`.

#### Parameters

shader | a GstGLShader |
index | attribute index to set |
name | name of the attribute |

## Types and Values

### GstGLShader

    typedef struct _GstGLShader GstGLShader;

## Property Details

### The `“linked”` property

      “linked”                   gboolean

Shader link status.

Flags: Read

Default value: FALSE

## See Also

GstGLSLStage