push_gl_shader


Description:

public void push_gl_shader (GLShader shader, Rect bounds, owned Bytes take_args)

Push a [class@Gsk.

GLShaderNode].

The node uses the given [[email protected]] and uniform values Additionally this takes a list of n_children other nodes which will be passed to the [[email protected]].

The take_args argument is a block of data to use for uniform arguments, as per types and offsets defined by the shader . Normally this is generated by [[email protected]_args] or [[email protected]].

The snapshotter takes ownership of take_args, so the caller should not free it after this.

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 [[email protected]] to ensure the shader will work for the renderer before using it.

If the shader requires textures (see [[email protected]_n_textures]), then it is expected that you call [ [email protected]_shader_pop_texture] the number of times that are required. Each of these calls will generate a node that is added as a child to the `GskGLShaderNode`, which in turn will render these offscreen and pass as a texture to the shader.

Once all textures (if any) are pop:ed, you must call the regular [[email protected]].

If you want to use pre-existing textures as input to the shader rather than rendering new ones, use [[email protected]_texture] to push a texture node. These will be used directly rather than being re-rendered.

For details on how to write shaders, see [[email protected]].

Parameters:

this

a `GtkSnapshot`

shader

The code to run

bounds

the rectangle to render into

take_args

Data block with arguments for the shader.




2022 vala-language.org