// TEXTURE DISTORTING // mikkel . crone . koser / www.beyondthree.com // modifed backgroundimage example by REAS // vertexTexture discovery by ELOUT :) // oh well, i know the effect is very cheesy, but hey.... // QUADS ARE NICE :) BImage a; int y; float rZ = 0f; void setup() { size(360, 360); background(0, 0, 0); //a 200*200 pixel size image - in your data folder. a = loadImage("milan_rubbish.jpg"); noStroke(); } void loop(){ y = max((int)((mouseY/(float)height)*90f), 4);; rZ = rZ + 0.05; translate(width/2, height/2, 400); rotateZ(rZ); // ONE beginShape(QUADS); texture(a); vertex(0,0,0, -100-y,100-y); vertex(100,0,0, -100-y,0); vertex(100,100,0, 0,0); vertex(0,100,0, 0,0); endShape(); // TWO beginShape(QUADS); texture(a); vertex(0,0,0, -100-y,100-y); vertex(-100,0,0, -100-y,0); vertex(-100,-100,0, 0,0); vertex(0,-100,0, 0,0); endShape(); // THREE beginShape(QUADS); texture(a); vertex(0,0,0, -100-y,100-y); vertex(100,0,0, -100-y,0); vertex(100,-100,0, 0,0); vertex(0,-100,0, 0,0); endShape(); // FOUR beginShape(QUADS); texture(a); vertex(0,0,0, -100-y,100-y); vertex(-100,0,0, -100-y,0); vertex(-100,100,0, 0,0); vertex(0,100,0, 0,0); endShape(); }