As it happens, I do have a demo of a sketch with both a 2D section and a 3D section:
Quote:/// "ThreeViews" by TfGuy44 (TfGuy44@gmail.com)
PGraphics BC, GC, RC;
float rot = 0.0;
void setup(){
size( 400, 200, P2D);
BC = createGraphics(200, 200, P3D);
RC = createGraphics(200, 200, P3D);
GC = createGraphics(200, 200, P3D);
}
void draw(){
rot=(rot+0.01)%360;
background(0);
noStroke();
fill(color(255,0,0));
rect(10,40,20,20);
fill(color(0,0,255));
rect(70,70,20,20);
fill(color(0,255,0));
rect(70,10,20,20);
if( get( mouseX, mouseY ) == color(255,0,0) ){
RC.beginDraw();
RC.background(color(128,0,0));
RC.fill(color(255,0,0));
RC.lights();
RC.translate(100,100,0);
RC.rotateX(rot);
RC.rotateY(2*rot);
RC.box(20);
RC.endDraw();
image( RC.get(), 200, 0);
}
if( get( mouseX, mouseY ) == color(0,255,0) ){
GC.beginDraw();
GC.background(color(0,128,0));
GC.fill(color(0,255,0));
GC.lights();
GC.translate(100,100,0);
GC.rotateX(rot);
GC.rotateY(2*rot);
GC.box(50);
GC.endDraw();
image( GC.get(), 200, 0);
}
if( get( mouseX, mouseY ) == color(0,0,255) ){
BC.beginDraw();
BC.background(color(0,0,128));
BC.fill(color(0,0,255));
BC.lights();
BC.translate(100,100,0);
BC.rotateX(rot);
BC.rotateY(2*rot);
BC.box(80);
BC.endDraw();
image( BC.get(), 200, 0);
}
}
Give me a few minutes and I'll see if I can fangle it into something a bit more useful.