Examples mods for 2.0

This commit is contained in:
Casey Reas
2011-09-16 05:00:28 +00:00
parent c3b8b312a0
commit 472fd13b2f
20 changed files with 210 additions and 241 deletions
@@ -1,9 +1,13 @@
/**
* Texture 2.
* Texture Triangle.
*
* Using a rectangular image to map a texture onto a triangle.
*/
// @pjs preload must be used to preload media if the program is
// running with Processing.js
/* @pjs preload="berlin-1.jpg"; */
PImage img;
void setup() {
@@ -14,12 +18,12 @@ void setup() {
void draw() {
background(0);
translate(width / 2, height / 2);
translate(width/2, height/2, 0);
rotateY(map(mouseX, 0, width, -PI, PI));
beginShape();
texture(img);
vertex(-100, -100, 0, 0, 0);
vertex(100, -40, 0, 400, 120);
vertex(100, -40, 0, 300, 120);
vertex(0, 100, 0, 200, 400);
endShape();
}