Gsk.GLShaderNode

g Gsk.GLShaderNode Gsk.GLShaderNode Gsk.RenderNode Gsk.RenderNode Gsk.RenderNode->Gsk.GLShaderNode

Subclasses:

None

Methods

Inherited:

Gsk.RenderNode (8)

class

new (shader, bounds, args, children)

get_args ()

get_child (idx)

get_n_children ()

get_shader ()

Virtual Methods

None

Fields

None

Class Details

class Gsk.GLShaderNode
Bases:

Gsk.RenderNode

Abstract:

No

A render node using a GL shader when drawing its children nodes.

classmethod new(shader, bounds, args, children)
Parameters:
  • shader (Gsk.GLShader) – the GskGLShader

  • bounds (Graphene.Rect) – the rectangle to render the shader into

  • args (GLib.Bytes) – Arguments for the uniforms

  • children ([Gsk.RenderNode] or None) – array of child nodes, these will be rendered to textures and used as input.

Returns:

A new GskRenderNode

Return type:

Gsk.GLShaderNode

Creates a GskRenderNode that will render the given shader into the area given by bounds.

The args is a block of data to use for uniform input, as per types and offsets defined by the shader. Normally this is generated by [method`Gsk`.GLShader.format_args] or [struct`Gsk`.ShaderArgsBuilder].

See [class`Gsk`.GLShader] for details about how the shader should be written.

All the children will be rendered into textures (if they aren’t already GskTextureNodes, which will be used directly). These textures will be sent as input to the shader.

If the renderer doesn’t support GL shaders, or if there is any problem when compiling the shader, then the node will draw pink. You should use [method`Gsk`.GLShader.compile] to ensure the shader will work for the renderer before using it.

get_args()
Returns:

A GBytes with the uniform arguments

Return type:

GLib.Bytes

Gets args for the node.

get_child(idx)
Parameters:

idx (int) – the position of the child to get

Returns:

the idx'th child of self

Return type:

Gsk.RenderNode

Gets one of the children.

get_n_children()
Returns:

The number of children

Return type:

int

Returns the number of children

get_shader()
Returns:

the GskGLShader shader

Return type:

Gsk.GLShader

Gets shader code for the node.