BImage img1,img2; float angle; void setup() { size(300,300); img1=loadImage("icon_proce55ing.gif"); img2=loadImage("icon_smiley.gif"); framerate(20); } void loop() { background(0); noStroke(); angle-=1.5; // angle=45; // First box push(); // store world coordinates translate(100,150,0); // translate to correct position rotateX(radians(angle)); rotateY(radians(angle)); beginShape(QUADS); texture(img1); // Set img1 as texture for this shape drawCube(30); endShape(); pop(); // Second box push(); translate(200,150,0); rotateX(-radians(angle)); rotateY(-radians(angle)*1.375); beginShape(QUADS); texture(img2); drawCube(30); endShape(); pop(); } void drawCube(float r) { // the first 3 coordinates are X,Y,Z // the last 2 coordinates are the U,V texture coordinates // U,V are coordinates of the image to be used as a texture // front face vertex(-r,-r,r, 0,0); vertex(r,-r,r, 30,0); vertex(r,r,r, 30,30); vertex(-r,r,r, 0,30); // back face vertex(-r,-r,-r, 30,0); vertex(r,-r,-r, 0,0); vertex(r,r,-r, 0,30); vertex(-r,r,-r, 30,30); // right side face vertex(r,-r,-r, 30,0); vertex(r,-r,r, 0,0); vertex(r,r,r, 0,30); vertex(r,r,-r, 30,30); // left side face vertex(-r,-r,-r, 0,0); vertex(-r,r,-r, 0,30); vertex(-r,r,r, 30,30); vertex(-r,-r,r, 30,0); // top face vertex(-r,r,r, 0,0); vertex(-r,r,-r, 0,30); vertex(r,r,-r, 30,30); vertex(r,r,r, 30,0); // bottom face vertex(-r,-r,r, 0,0); vertex(-r,-r,-r, 30,0); vertex(r,-r,-r, 30,30); vertex(r,-r,r, 0,30); }