Class: Gsk::GLShaderNode

Inherits:
RenderNode show all
Defined in:
(unknown)

Overview

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

Instance Method Summary collapse

Methods inherited from RenderNode

deserialize, #draw, #get_bounds, #node_type, #ref, #serialize, #unref, #write_to_file

Constructor Details

#initialize(shader, bounds, args, children, n_children) ⇒ 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
[methodGsk.GLShader.format_args] or [structGsk.ShaderArgsBuilder].

See [classGsk.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
[methodGsk.GLShader.compile] to ensure the shader will work for the
renderer before using it.

Parameters:

  • shader (Gsk::GLShader)

    the GskGLShader

  • bounds (Graphene::Rect)

    the rectangle to render the shader into

  • args (GLib::Bytes)

    Arguments for the uniforms

  • children (Array<Gsk::RenderNode>)

    array of child nodes,
    these will be rendered to textures and used as input.

  • n_children (Integer)

    Length of children (currently the GL backend supports
    up to 4 children)

Instance Method Details

#argsGLib::Bytes

Gets args for the node.

Returns:

  • (GLib::Bytes)

    A GBytes with the uniform arguments

#get_child(idx) ⇒ Gsk::RenderNode

Gets one of the children.

Parameters:

  • idx (Integer)

    the position of the child to get

Returns:

#n_childrenInteger

Returns the number of children

Returns:

  • (Integer)

    The number of children

#shaderGsk::GLShader

Gets shader code for the node.

Returns: