GstGL.GLShader

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned GstGL.GLShader GstGL.GLShader Gst.Object->GstGL.GLShader

Subclasses:

None

Methods

Inherited:

Gst.Object (27), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (context)

class

new_default (context)

class

string_fragment_external_oes_get_default (context, version, profile)

class

string_fragment_get_default (context, version, profile)

class

string_get_highest_precision (context, version, profile)

attach (stage)

attach_unlocked (stage)

bind_attribute_location (index, name)

bind_frag_data_location (index, name)

compile_attach_stage (stage)

detach (stage)

detach_unlocked (stage)

get_attribute_location (name)

get_program_handle ()

is_linked ()

link ()

release ()

release_unlocked ()

set_uniform_1f (name, value)

set_uniform_1fv (name, value)

set_uniform_1i (name, value)

set_uniform_1iv (name, value)

set_uniform_2f (name, v0, v1)

set_uniform_2fv (name, value)

set_uniform_2i (name, v0, v1)

set_uniform_2iv (name, value)

set_uniform_3f (name, v0, v1, v2)

set_uniform_3fv (name, value)

set_uniform_3i (name, v0, v1, v2)

set_uniform_3iv (name, value)

set_uniform_4f (name, v0, v1, v2, v3)

set_uniform_4fv (name, value)

set_uniform_4i (name, v0, v1, v2, v3)

set_uniform_4iv (name, value)

set_uniform_matrix_2fv (name, count, transpose, value)

set_uniform_matrix_2x3fv (name, count, transpose, value)

set_uniform_matrix_2x4fv (name, count, transpose, value)

set_uniform_matrix_3fv (name, count, transpose, value)

set_uniform_matrix_3x2fv (name, count, transpose, value)

set_uniform_matrix_3x4fv (name, count, transpose, value)

set_uniform_matrix_4fv (name, count, transpose, value)

set_uniform_matrix_4x2fv (name, count, transpose, value)

set_uniform_matrix_4x3fv (name, count, transpose, value)

use ()

Virtual Methods

Inherited:

Gst.Object (1), GObject.Object (7)

Properties

Inherited:

Gst.Object (2)

Name

Type

Flags

Short Description

linked

bool

r

Shader link status

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Type

Access

Description

context

GstGL.GLContext

r

parent

Gst.Object

r

Class Details

class GstGL.GLShader(**kwargs)
Bases:

Gst.Object

Abstract:

No

Structure:

GstGL.GLShaderClass

classmethod new(context)[source]
Parameters:

context (GstGL.GLContext) – a GstGL.GLContext

Returns:

a new empty shader

Return type:

GstGL.GLShader

Note: must be called in the GL thread

classmethod new_default(context)[source]
Parameters:

context (GstGL.GLContext) – a GstGL.GLContext

Raises:

GLib.Error

Returns:

a default shader or None on failure

Return type:

GstGL.GLShader

Note: must be called in the GL thread

New in version 1.8.

classmethod string_fragment_external_oes_get_default(context, version, profile)[source]
Parameters:
Returns:

a passthrough shader string for copying an input external-oes texture to the output

Return type:

str

New in version 1.16.

classmethod string_fragment_get_default(context, version, profile)[source]
Parameters:
Returns:

a passthrough shader string for copying an input texture to the output

Return type:

str

New in version 1.16.

classmethod string_get_highest_precision(context, version, profile)[source]
Parameters:
Returns:

a shader string defining the precision of float types based on context, version and profile

Return type:

str

Generates a shader string that defines the precision of float types in GLSL shaders. This is particularly needed for fragment shaders in a GLSL ES context where there is no default precision specified.

Practically, this will return the string ‘precision mediump float’ or ‘precision highp float’ depending on if high precision floats are determined to be supported.

New in version 1.16.

attach(stage)[source]
Parameters:

stage (GstGL.GLSLStage) – a GstGL.GLSLStage to attach

Returns:

whether stage could be attached to self

Return type:

bool

Attaches stage to self. stage must have been successfully compiled with GstGL.GLSLStage.compile().

Note: must be called in the GL thread

New in version 1.8.

attach_unlocked(stage)[source]
Parameters:

stage (GstGL.GLSLStage) – a GstGL.GLSLStage to attach

Returns:

whether stage could be attached to self

Return type:

bool

Attaches stage to self. stage must have been successfully compiled with GstGL.GLSLStage.compile().

Note: must be called in the GL thread

New in version 1.8.

bind_attribute_location(index, name)[source]
Parameters:
  • index (int) – attribute index to set

  • name (str) – name of the attribute

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

bind_frag_data_location(index, name)[source]
Parameters:
  • index (int) – attribute index to set

  • name (str) – name of the attribute

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

compile_attach_stage(stage)[source]
Parameters:

stage (GstGL.GLSLStage) – a GstGL.GLSLStage to attach

Raises:

GLib.Error

Returns:

whether stage could be compiled and attached to self

Return type:

bool

Compiles stage and attaches it to self.

Note: must be called in the GL thread

New in version 1.8.

detach(stage)[source]
Parameters:

stage (GstGL.GLSLStage) – a GstGL.GLSLStage to attach

Detaches stage from self. stage must have been successfully attached to self with GstGL.GLShader.attach() or GstGL.GLShader.attach_unlocked().

Note: must be called in the GL thread

New in version 1.8.

detach_unlocked(stage)[source]
Parameters:

stage (GstGL.GLSLStage) – a GstGL.GLSLStage to attach

Detaches stage from self. stage must have been successfully attached to self with GstGL.GLShader.attach() or GstGL.GLShader.attach_unlocked().

Note: must be called in the GL thread

New in version 1.8.

get_attribute_location(name)[source]
Parameters:

name (str) – name of the attribute

Returns:

the attribute index for name in self or -1 on failure

Return type:

int

get_program_handle()[source]
Returns:

the GL program handle for this shader

Return type:

int

New in version 1.8.

is_linked()[source]
Returns:

whether self has been successfully linked

Return type:

bool

Note: must be called in the GL thread

New in version 1.8.

Raises:

GLib.Error

Returns:

whether self could be linked together.

Return type:

bool

Links the current list of GstGL.GLSLStage's in self.

Note: must be called in the GL thread

New in version 1.8.

release()[source]

Releases the shader and stages.

Note: must be called in the GL thread

New in version 1.8.

release_unlocked()[source]

Releases the shader and stages.

Note: must be called in the GL thread

New in version 1.8.

set_uniform_1f(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value (float) – value to set

Perform glUniform1f() for name on self

set_uniform_1fv(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value ([float]) – values to set

Perform glUniform1fv() for name on self

set_uniform_1i(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value (int) – value to set

Perform glUniform1i() for name on self

set_uniform_1iv(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value ([int]) – values to set

Perform glUniform1iv() for name on self

set_uniform_2f(name, v0, v1)[source]
Parameters:
  • name (str) – name of the uniform

  • v0 (float) – first value to set

  • v1 (float) – second value to set

Perform glUniform2f() for name on self

set_uniform_2fv(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value ([float]) – values to set

Perform glUniform2fv() for name on self

set_uniform_2i(name, v0, v1)[source]
Parameters:
  • name (str) – name of the uniform

  • v0 (int) – first value to set

  • v1 (int) – second value to set

Perform glUniform2i() for name on self

set_uniform_2iv(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value ([int]) – values to set

Perform glUniform2iv() for name on self

set_uniform_3f(name, v0, v1, v2)[source]
Parameters:
  • name (str) – name of the uniform

  • v0 (float) – first value to set

  • v1 (float) – second value to set

  • v2 (float) – third value to set

Perform glUniform3f() for name on self

set_uniform_3fv(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value ([float]) – values to set

Perform glUniform3fv() for name on self

set_uniform_3i(name, v0, v1, v2)[source]
Parameters:
  • name (str) – name of the uniform

  • v0 (int) – first value to set

  • v1 (int) – second value to set

  • v2 (int) – third value to set

Perform glUniform3i() for name on self

set_uniform_3iv(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value ([int]) – values to set

Perform glUniform3iv() for name on self

set_uniform_4f(name, v0, v1, v2, v3)[source]
Parameters:
  • name (str) – name of the uniform

  • v0 (float) – first value to set

  • v1 (float) – second value to set

  • v2 (float) – third value to set

  • v3 (float) – fourth value to set

Perform glUniform4f() for name on self

set_uniform_4fv(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value ([float]) – values to set

Perform glUniform4fv() for name on self

set_uniform_4i(name, v0, v1, v2, v3)[source]
Parameters:
  • name (str) – name of the uniform

  • v0 (int) – first value to set

  • v1 (int) – second value to set

  • v2 (int) – third value to set

  • v3 (int) – fourth value to set

Perform glUniform4i() for name on self

set_uniform_4iv(name, value)[source]
Parameters:
  • name (str) – name of the uniform

  • value ([int]) – values to set

Perform glUniform4iv() for name on self

set_uniform_matrix_2fv(name, count, transpose, value)[source]
Parameters:
  • name (str) – name of the uniform

  • count (int) – number of 2x2 matrices to set

  • transpose (bool) – transpose the matrix

  • value (float) – matrix to set

Perform glUniformMatrix2fv() for name on self

set_uniform_matrix_2x3fv(name, count, transpose, value)[source]
Parameters:
  • name (str) – name of the uniform

  • count (int) – number of 2x3 matrices to set

  • transpose (bool) – transpose the matrix

  • value (float) – values to set

Perform glUniformMatrix2x3fv() for name on self

set_uniform_matrix_2x4fv(name, count, transpose, value)[source]
Parameters:
  • name (str) – name of the uniform

  • count (int) – number of 2x4 matrices to set

  • transpose (bool) – transpose the matrix

  • value (float) – values to set

Perform glUniformMatrix2x4fv() for name on self

set_uniform_matrix_3fv(name, count, transpose, value)[source]
Parameters:
  • name (str) – name of the uniform

  • count (int) – number of 3x3 matrices to set

  • transpose (bool) – transpose the matrix

  • value (float) – values to set

Perform glUniformMatrix3fv() for name on self

set_uniform_matrix_3x2fv(name, count, transpose, value)[source]
Parameters:
  • name (str) – name of the uniform

  • count (int) – number of 3x2 matrices to set

  • transpose (bool) – transpose the matrix

  • value (float) – values to set

Perform glUniformMatrix3x2fv() for name on self

set_uniform_matrix_3x4fv(name, count, transpose, value)[source]
Parameters:
  • name (str) – name of the uniform

  • count (int) – number of 3x4 matrices to set

  • transpose (bool) – transpose the matrix

  • value (float) – values to set

Perform glUniformMatrix3x4fv() for name on self

set_uniform_matrix_4fv(name, count, transpose, value)[source]
Parameters:
  • name (str) – name of the uniform

  • count (int) – number of 4x4 matrices to set

  • transpose (bool) – transpose the matrix

  • value (float) – values to set

Perform glUniformMatrix4fv() for name on self

set_uniform_matrix_4x2fv(name, count, transpose, value)[source]
Parameters:
  • name (str) – name of the uniform

  • count (int) – number of 4x2 matrices to set

  • transpose (bool) – transpose the matrix

  • value (float) – values to set

Perform glUniformMatrix4x2fv() for name on self

set_uniform_matrix_4x3fv(name, count, transpose, value)[source]
Parameters:
  • name (str) – name of the uniform

  • count (int) – number of 4x3 matrices to set

  • transpose (bool) – transpose the matrix

  • value (float) – values to set

Perform glUniformMatrix4x3fv() for name on self

use()[source]

Mark’s self as being used for the next GL draw command.

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

Property Details

GstGL.GLShader.props.linked
Name:

linked

Type:

bool

Default Value:

False

Flags:

READABLE

Shader link status