textureMode() \ Language (API) \ Processing 1.0
Author: Casey Reas & Ben Fry
Description: Processing is an electronic sketchbook for developing ideas. It is a context for learning fundamentals of computer programming within the context of the electronic arts.
Keywords: Processing, Processing, Interactive Media, Electronic Arts, Programming, Java, Ben Fry, Casey Reas

Reference for Processing version 1.5. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name | ### textureMode()
Examples |
    noStroke();
    PImage a = loadImage("arch.jpg");
    textureMode(IMAGE);
    beginShape();
    texture(a);
    vertex(10, 20, 0, 0);
    vertex(80, 5, 100, 0);
    vertex(95, 90, 100, 100);
    vertex(40, 95, 0, 100);
    endShape();
    noStroke();
    PImage a = loadImage("arch.jpg");
    textureMode(NORMALIZED);
    beginShape();
    texture(a);
    vertex(10, 20, 0, 0);
    vertex(80, 5, 1, 0);
    vertex(95, 90, 1, 1);
    vertex(40, 95, 0, 1);
    endShape();
Description | Sets the coordinate space for texture mapping. There are two options, IMAGE, which refers to the actual coordinates of the image, and NORMALIZED, which refers to a normalized space of values ranging from 0 to 1. The default mode is IMAGE. In 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) (0,100) (100,200) (0,200). The same mapping in NORMAL_SPACE is (0,0) (0,1) (1,1) (0,1).
Syntax |
    textureMode(MODE);
Parameters |
MODE | either IMAGE or NORMALIZED
Returns | None
Usage | Application & Web
Related | texture()

Updated on August 30, 2010 04:29:39pm EDT