import processing.video.*; Movie tex; // PImage tex; float rotx = PI/4; float roty = PI/4; void setup() { size(640, 640, P3D); tex = new Movie(this, "testMovie.mov"); tex.loop(); // tex = loadImage("testImage.jpg"); textureMode(NORMAL); fill(255); stroke(color(44,48,32)); } void draw() { background(0); noStroke(); translate(width/2.0, height/2.0, -100); rotateX(rotx); rotateY(roty); scale(90); TexturedCube(tex); } void movieEvent(Movie m) { m.read(); } void TexturedCube(PImage tex) { // fill(255); beginShape(QUADS); texture(tex); // +Z "front" face vertex(-1, -1, 1, 0, 0); vertex( 1, -1, 1, 1, 0); vertex( 1, 1, 1, 1, 1); vertex(-1, 1, 1, 0, 1); // -Z "back" face vertex( 1, -1, -1, 0, 0); vertex(-1, -1, -1, 1, 0); vertex(-1, 1, -1, 1, 1); vertex( 1, 1, -1, 0, 1); // +Y "bottom" face vertex(-1, 1, 1, 0, 0); vertex( 1, 1, 1, 1, 0); vertex( 1, 1, -1, 1, 1); vertex(-1, 1, -1, 0, 1); // -Y "top" face vertex(-1, -1, -1, 0, 0); vertex( 1, -1, -1, 1, 0); vertex( 1, -1, 1, 1, 1); vertex(-1, -1, 1, 0, 1); // +X "right" face vertex( 1, -1, 1, 0, 0); vertex( 1, -1, -1, 1, 0); vertex( 1, 1, -1, 1, 1); vertex( 1, 1, 1, 0, 1); // -X "left" face vertex(-1, -1, -1, 0, 0); vertex(-1, -1, 1, 1, 0); vertex(-1, 1, 1, 1, 1); vertex(-1, 1, -1, 0, 1); endShape(); } void mouseDragged() { float rate = 0.01; rotx += (pmouseY-mouseY) * rate; roty += (mouseX-pmouseX) * rate; }