/** * 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 processing.opengl.*; GestaltPlugIn gestalt; Plane _myPlaneIn3D; Plane _myPlaneIn2D; void setup() { /* setup p5 */ size(640, 480, OPENGL); rectMode(CENTER); noStroke(); gestalt = new GestaltPlugIn(this); /* create planes */ _myPlaneIn3D = gestalt.drawablefactory().plane(); _myPlaneIn3D.scale().x = 50; _myPlaneIn3D.scale().y = 150; gestalt.bin(Gestalt.BIN_3D).add(_myPlaneIn3D); _myPlaneIn2D = gestalt.drawablefactory().plane(); _myPlaneIn2D.scale().x = 50; _myPlaneIn2D.scale().y = 150; gestalt.bin(Gestalt.BIN_2D_FOREGROUND).add(_myPlaneIn2D); noCursor(); } void draw() { /* glue gestalt shapes to mouse */ _myPlaneIn3D.position().x = mouseX - 60; _myPlaneIn3D.position().y = mouseY; _myPlaneIn2D.position().x = mouseX + 60; _myPlaneIn2D.position().y = mouseY; /* clear screen */ background(255, 128, 0); /* draw processing shape */ rect(gestalt.event().mouseX, gestalt.event().mouseY, 50, 150); }