## 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/codecparsers/gstmpeg4parser.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 |

#### 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 |

#### 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);

### gst_gl_shader_set_uniform_1f ()

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

### gst_gl_shader_set_uniform_1fv ()

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

### gst_gl_shader_set_uniform_1iv ()

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

### gst_gl_shader_set_uniform_2f ()

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

### gst_gl_shader_set_uniform_2fv ()

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

### gst_gl_shader_set_uniform_2i ()

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

### gst_gl_shader_set_uniform_2iv ()

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

### gst_gl_shader_set_uniform_3f ()

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

### gst_gl_shader_set_uniform_3fv ()

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

### gst_gl_shader_set_uniform_3i ()

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

### gst_gl_shader_set_uniform_3iv ()

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

### 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);

### gst_gl_shader_set_uniform_4fv ()

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

### 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);

### gst_gl_shader_set_uniform_4iv ()

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

### 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);

### 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);

### 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);

### 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);

### 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);

### 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);

### 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);

### 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);

### 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);

### gst_gl_shader_get_attribute_location ()

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

### gst_gl_shader_bind_attribute_location ()

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

### gst_gl_shader_bind_frag_data_location ()

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

## 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