Reference+
Name
texture()
Description
Sets a texture to be applied to vertex points. The texture() function must be called between beginShape() and endShape() and before any calls to vertex(). This function 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.Examples
size(400, 400, P3D); noStroke(); PImage img = loadImage("shells.jpg"); textureMode(NORMAL); beginShape(); texture(img); vertex(40, 80, 0, 0); vertex(320, 20, 1, 0); vertex(380, 360, 1, 1); vertex(160, 380, 0, 1); endShape();
Syntax
texture(image)
Parameters
image
(PImage)
reference to a PImage object
Return
void
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.