texture()

Sets a texture to be applied to vertex points.

Examples

example picture for texture()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
def setup():
    py5.size(100, 100, py5.P3D)
    py5.no_stroke()
    img = py5.load_image("laDefense.jpg")
    py5.begin_shape()
    py5.texture(img)
    py5.vertex(10, 20, 0, 0)
    py5.vertex(80, 5, 100, 0)
    py5.vertex(95, 90, 100, 100)
    py5.vertex(40, 95, 0, 100)
    py5.end_shape()

Description

Sets a texture to be applied to vertex points. The texture() method must be called between begin_shape() and end_shape() and before any calls to vertex(). This method only works with the P2D and P3D renderers.

When textures are in use, the fill color is ignored. Instead, use tint() to specify the color of the texture as it is applied to the shape.

Underlying Java method: texture

Syntax

texture(image: Py5Image, /) -> None

Parameters

  • image: Py5Image - reference to a Py5Image object

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