Hello everybody,
First of all, I'm french, so my English may be hardly understandable. Don't hesitate to correct me:)
I'm working on a small processing applet, and I would like to divide the applet between two (or even more) areas:
One zone (the top half part of the applet) using an OPENGL renderer dor 3D animations, and the other zone (bottom half) using a P2D applet.
Is this possible? It seems to be possible with use of PGraphic, but I don't understand how to do this.
The classical way to use 2 renderes is like this example:
Code:
import processing.core.*;
public class Test extends PApplet {
private PGraphics g1, g2;
public void setup() {
size(400,400);
g1=createGraphics(400, 200, P2D);
g2=createGraphics(400, 200, P3D);
}
public void draw() {
g1.beginDraw(); {
g1.rect(10, 20, 100, 80);
} g1.endDraw();
image(g1, 0, 0);
g2.beginDraw(); {
g2.background(0);
g2.fill(255);
g2.stroke(255);
g2.translate(100, 80);
g2.sphere(20);
} g2.endDraw();
image(g2, 0, 200);
}
}
This work well, the top middle of the screen show a 2D box, and the bottom one show a sphere on a black background
But when I try to remplace P3D with OPENGL, This doesn't work anymore! The OPENGL graphic recover the whole applet...
Does anybody has any idea about this? I've spent some hours trying to fix it, and I haven't found any example or tutorial about this?
Some help would be great
Thanks
Amaury