shader()

Applies the shader specified by the parameters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
def setup():
    py5.size(640, 360, py5.P2D)
    global edges
    global img
    img = py5.load_image("leaves.jpg")
    edges = py5.load_shader("edges.glsl")


def draw():
    py5.shader(edges)
    py5.image(img, 0, 0)

Description

Applies the shader specified by the parameters. It’s compatible with the P2D and P3D renderers, but not with the default renderer.

Underlying Java method: shader

Syntax

shader(shader: Py5Shader, /) -> None
shader(shader: Py5Shader, kind: int, /) -> None

Parameters

  • kind: int - type of shader, either POINTS, LINES, or TRIANGLES

  • shader: Py5Shader - name of shader file

Updated on September 11, 2021 16:51:34pm UTC