texture_wrap()

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def setup():
    py5.size(300, 300, py5.P2D)
    global img
    img = py5.load_image("berlin-1.jpg")
    py5.texture_mode(py5.NORMAL)


def draw():
    py5.background(0)
    py5.translate(py5.width//2, py5.height//2)
    py5.rotate(py5.remap(py5.mouse_x, 0, py5.width, -py5.PI, py5.PI))
    if py5.is_mouse_pressed:
        py5.texture_wrap(py5.REPEAT)
    else:
        py5.texture_wrap(py5.CLAMP)

    py5.begin_shape()
    py5.texture(img)
    py5.vertex(-100, -100, 0, 0)
    py5.vertex(100, -100, 2, 0)
    py5.vertex(100, 100, 2, 2)
    py5.vertex(-100, 100, 0, 2)
    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 Java method: textureWrap

Syntax

texture_wrap(wrap: int, /) -> None

Parameters

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

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