/** * this demo shows how to use processing movie library with gestalt. */ import gestalt.Gestalt; import gestalt.p5.GestaltPlugIn; import gestalt.shape.Plane; import gestalt.shape.material.TexturePlugin; import processing.core.PApplet; import processing.video.Movie; import processing.opengl.*; GestaltPlugIn gestalt; Plane _myMoviePlane; Movie _myMovie; TexturePlugin _myTexture; void setup() { /* setup p5 */ size(640, 480, OPENGL); rectMode(CENTER); noStroke(); gestalt = new GestaltPlugIn(this); _myMovie = new Movie(this, "movie.mov"); _myMovie.loop(); _myMovie.read(); /* create a texture with reference to movie data 'myMovie.pixels' */ _myTexture = gestalt.drawablefactory().texture(); _myTexture.setFilterType(Gestalt.TEXTURE_FILTERTYPE_NEAREST); _myTexture.load(gestalt.createGestaltBitmap(_myMovie)); /* create planes */ _myMoviePlane = gestalt.drawablefactory().plane(); _myMoviePlane.material().addPlugin(_myTexture); _myMoviePlane.setPlaneSizeToTextureSize(); _myMoviePlane.scale().scale(4); gestalt.bin(Gestalt.BIN_3D).add(_myMoviePlane); } void movieEvent(Movie theMovie) { theMovie.read(); } void draw() { /* clear screen */ background(255, 0, 128); /* glue shapes to mouse */ _myMoviePlane.position().x = mouseX; _myMoviePlane.position().y = mouseY; /* update pixels in texture */ _myTexture.reload(); }