texture_wrap()#

Defines if textures repeat or draw once within a texture map.

Examples#

 1def setup():
 2    global img
 3    py5.size(300, 300, py5.P2D)
 4    img = py5.load_image("berlin-1.jpg")
 5    py5.texture_mode(py5.NORMAL)
 6
 7
 8def draw():
 9    py5.background(0)
10    py5.translate(py5.width//2, py5.height//2)
11    py5.rotate(py5.remap(py5.mouse_x, 0, py5.width, -py5.PI, py5.PI))
12    if py5.is_mouse_pressed:
13        py5.texture_wrap(py5.REPEAT)
14    else:
15        py5.texture_wrap(py5.CLAMP)
16
17    py5.begin_shape()
18    py5.texture(img)
19    py5.vertex(-100, -100, 0, 0)
20    py5.vertex(100, -100, 2, 0)
21    py5.vertex(100, 100, 2, 2)
22    py5.vertex(-100, 100, 0, 2)
23    py5.end_shape()

Description#

Defines if textures repeat or draw once within a texture map. The two parameters are CLAMP (the default behavior) and REPEAT. This function only works with the P2D and P3D renderers.

Underlying Processing method: textureWrap

Syntax#

texture_wrap(wrap: int, /) -> None

Parameters#

  • wrap: int - Either CLAMP (default) or REPEAT

Updated on March 22, 2022 21:53:01pm UTC