Method

GtkSnapshotpush_gl_shader

deprecated: 4.16 

Declaration [src]

void
gtk_snapshot_push_gl_shader (
  GtkSnapshot* snapshot,
  GskGLShader* shader,
  const graphene_rect_t* bounds,
  GBytes* take_args
)

Description [src]

Push a GskGLShaderNode.

The node uses the given GskGLShader and uniform values Additionally this takes a list of n_children other nodes which will be passed to the GskGLShaderNode.

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 gsk_gl_shader_format_args() or GskShaderArgsBuilder.

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 gsk_gl_shader_compile() to ensure the shader will work for the renderer before using it.

If the shader requires textures (see gsk_gl_shader_get_n_textures()), then it is expected that you call gtk_snapshot_gl_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 gtk_snapshot_pop().

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

For details on how to write shaders, see GskGLShader.

Deprecated since: 4.16

GTK’s new Vulkan-focused rendering does not support this feature. Use GtkGLArea for OpenGL rendering.

Parameters

shader

Type: GskGLShader

The code to run.

The data is owned by the caller of the method.
bounds

Type: graphene_rect_t

The rectangle to render into.

The data is owned by the caller of the method.
take_args

Type: GBytes

Data block with arguments for the shader.

The instance takes ownership of the data, and is responsible for freeing it.