Hi all,
I'm trying to use two opengl windows in eclipse:
Code:
import java.awt.Frame;
import processing.core.PApplet;
public class TestProcessingApplet extends PApplet {
// PFrame f;
secondApplet s;
public void setup() {
size(320, 240);
frameRate(15);
new PFrame(); // was PFrame f = new PFrame();
}
public void draw() {
background(255, 0, 0);
fill(0);
rect(20, 20, 50, 50 + frameCount);
}
public class PFrame extends Frame {
public PFrame() {
setBounds(300, 300, 400, 300);
s = new secondApplet();
add(s);
s.init();
setVisible(true); // was show();
}
}
public class secondApplet extends PApplet {
public void setup() {
size(400, 300);
frameRate(15);
}
public void draw() {
background(0);
fill(255);
rect(20, 20, 50, 50 - frameCount);
redraw();
}
}
}
I'm using Mac OS X.
When i draw only one window works ok.
But if I draw two windows i get the error:
Exception in thread "Animation Thread" javax.media.opengl.GLException: Can not destroy context while it is current
at com.sun.opengl.impl.GLContextImpl.destroy(GLContextImpl.java:176)
at processing.opengl.PGraphicsOpenGL.allocate(PGraphicsOpenGL.java:201)
at processing.core.PGraphics3D.setSize(PGraphics3D.java:316)
at processing.core.PApplet.resizeRenderer(PApplet.java:930)
at processing.core.PApplet.size(PApplet.java:992)
at processing.core.PApplet.size(PApplet.java:958)
at TestProcessingApplet$secondApplet.setup(TestProcessingApplet.java:37)
Can you help me?
Thanks!