multiple P3D or OPENGL windows
in
Contributed Library Questions
•
2 months ago
hi,
I need to work with multiple windows for my new project.
I've already learned how to create those like this:
- import java.awt.Frame;
- import java.awt.BorderLayout;
- ControlFrame cf;
- void setup(){
- size(400,400);
- cf = addControlFrame("extra", 400,825);
- }
- void draw(){
- background(0);
- }
- ControlFrame addControlFrame(String theName, int theWidth, int theHeight) {
- Frame f = new Frame(theName);
- ControlFrame p = new ControlFrame(this, theWidth, theHeight);
- f.add(p);
- p.init();
- f.setTitle(theName);
- f.setSize(p.w, p.h);
- f.setLocation(140, 140);
- f.setResizable(false);
- f.setVisible(true);
- return p;
- }
- public class ControlFrame extends PApplet {
- int w, h;
- public void setup() {
- size(w, h);
- frameRate(30);
- }
- public void draw() {
- background(255);
- }
- private ControlFrame() {
- }
- public ControlFrame(Object theParent, int theWidth, int theHeight) {
- parent = theParent;
- w = theWidth;
- h = theHeight;
- }
- Object parent;
- }
It works perfectly as long as I'm staying in the 2D area. It also works if one of the windows changes into 3D mode,
but I can't get both of them to work in 3D mode...
I tried to do it like this:
- void setup(){
- size(400,400, OPENGL);
- cf = addControlFrame("extra", 400,825);
- }
- public void setup() {
- size(w, h, OPENGL);
- frameRate(30);
- }
Maybe someone knows if it is possible and how can I get it work?
best regards,
N.
1