Kanteran
Kanteran

Reputation: 80

JOGL GLCanvas resizing fails after a setVisible() call from another frame

I have a problem with JOGL. I`d like to create two windows. One with a GLCanvas and another one with something else. Every time I call setVisible() of another frame before calling setVisible() of the frame where I added the canvas. When resizing I get only a white window.

GLProfile profile = GLProfile.get(GLProfile.GL2);
GLCapabilities capabilities = new GLCapabilities(profile);
GLCanvas canvas = new GLCanvas(capabilities);
JFrame f2 = new JFrame();
f2.setSize(500, 500);
JFrame f = new JFrame();
f.setSize(500, 500);
canvas.setVisible(true);
f.add(canvas);
f2.setVisible(true);
f.setVisible(true);
f.pack();

If I change

f2.setVisible(true);
f.setVisible(true);

to

f.setVisible(true);
f2.setVisible(true);

everything works and I get my black window even after rescaling it.

Thank you for your help

Upvotes: 1

Views: 112

Answers (0)

Related Questions