Files
processing4/android/examples/OpenGL/Textures/Texture2/Texture2.pde
2012-02-12 21:33:18 +00:00

30 lines
609 B
Plaintext

// ISSUES: beginShape() need to be called with TRIANGLES because generic polygon
// tesselation still not implemented
/**
* Texture 2.
*
* Using a rectangular image to map a texture onto a triangle.
*/
PImage img;
void setup() {
size(640, 360, P3D);
orientation(LANDSCAPE);
img = loadImage("berlin-1.jpg");
noStroke();
}
void draw() {
background(0);
translate(width / 2, height / 2);
rotateY(map(mouseX, 0, width, -PI, PI));
beginShape(TRIANGLES);
texture(img);
vertex(-100, -100, 0, 0, 0);
vertex(100, -40, 0, 400, 120);
vertex(0, 100, 0, 200, 400);
endShape();
}