/** * this demo shows how to use a gestalt renderer from inside a processing applet. */ import gestalt.Gestalt; import gestalt.p5.GestaltPlugIn; import gestalt.shape.Plane; import gestalt.shape.material.TexturePlugin; import processing.opengl.*; GestaltPlugIn gestalt; Plane _myPlaneIn3D; TexturePlugin _myTexture; void setup() { /* setup p5 */ size(640, 480, OPENGL); rectMode(CENTER); noStroke(); gestalt = new GestaltPlugIn(this); /* create a texture with reference to image data 'myImage.pixels' */ PImage myImage = loadImage("auto.png"); _myTexture = gestalt.drawablefactory().texture(); _myTexture.load(gestalt.createGestaltBitmap(myImage)); /* create planes */ _myPlaneIn3D = gestalt.drawablefactory().plane(); _myPlaneIn3D.material().addPlugin(_myTexture); _myPlaneIn3D.setPlaneSizeToTextureSize(); gestalt.bin(Gestalt.BIN_3D).add(_myPlaneIn3D); } void draw() { /* clear screen */ background(128, 255, 0); /* glue shapes to mouse */ _myPlaneIn3D.position().x = mouseX; _myPlaneIn3D.position().y = mouseY; }