Reference×
Reference
- [] (array access)
- = (assign)
- catch
- class
- , (comma)
- // (comment)
- {} (curly braces)
- /** */ (doc comment)
- . (dot)
- draw()
- exit()
- extends
- false
- final
- implements
- import
- loop()
- /* */ (multiline comment)
- new
- noLoop()
- null
- () (parentheses)
- popStyle()
- pop()
- private
- public
- pushStyle()
- push()
- redraw()
- return
- ; (semicolon)
- setLocation()
- setResizable()
- setTitle()
- setup()
- static
- super
- this
- thread()
- true
- try
- void
Name
textureMode()
Description
Sets the coordinate space for texture mapping. The default mode is
IMAGE, which refers to the actual coordinates of the image.
NORMAL refers to a normalized space of values ranging from 0 to 1.
This function only works with the P2D and P3D renderers.
With IMAGE, if an image is 100 x 200 pixels, mapping the image onto
the entire size of a quad would require the points (0,0) (100, 0) (100,200)
(0,200). The same mapping in NORMAL is (0,0) (1,0) (1,1) (0,1).
Examples
size(400, 400, P3D); noStroke(); PImage img = loadImage("shells.jpg"); beginShape(); texture(img); vertex(40, 80, 0, 0); vertex(320, 20, 400, 0); vertex(380, 360, 400, 400); vertex(160, 380, 0, 400); endShape();
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
textureMode(mode)
Parameters
mode
(int)
either IMAGE or NORMAL
Return
void
Related

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.