Gnome::Gsk4::GLShaderNode
Description
A render node using a GL shader when drawing its children nodes.
Class initialization
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
new-glshadernode
Creates a Gnome::Gsk4::RenderNode 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 .format-args() in class Gnome::Gsk4::GLShader
or Gnome::Gsk4::N-ShaderArgsBuilder .
See Gnome::Gsk4::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 .compile() in class Gnome::Gsk4::GLShader
to ensure the $shader
will work for the renderer before using it.
method new-glshadernode ( N-Object() $shader, N-Object $bounds, N-Object $args, N-Object() $children, UInt() $n-children --> Gnome::Gsk4::GLShaderNode \)
$shader; the Gnome::Gsk4::GLShader.
$bounds; the rectangle to render the shader into
$args; Arguments for the uniforms
$children; array of child nodes, these will be rendered to textures and used as input..
$n-children; Length of
$children
(currenly the GL backend supports up to 4 children).
Methods
get-args
Gets args for the node.
method get-args (--> N-Object )
Return value; A Gnome::Glib::N-Bytes with the uniform arguments.
get-child
Gets one of the children.
method get-child ( UInt() $idx --> N-Object )
$idx; the position of the child to get.
Return value; the $idx
'th child of $node
.
get-n-children
Returns the number of children
method get-n-children (--> UInt )
Return value; The number of children.
get-shader
Gets shader code for the node.
method get-shader (--> N-Object )
Return value; the Gnome::Gsk4::GLShader shader.