I wrote a code to move a GLCanvas from a JFrame to another and move it back to the first. If I do this operation more than one time the GLCanvas disappear. I Experienced this problem with version 2.1.2 on windows 7 x64 platform. With jogl 2.0.2 the problem doesn't appear. This is the application: import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.WindowConstants; /** * * @author Zanelli Franco. <fzanelli@tecnosens.it> */ public class JoglFrameError extends JFrame { public JoglFrameError() { GLProfile profile = GLProfile.get(GLProfile.GL2); GLCapabilities glCapabilities = new GLCapabilities(profile); final GLCanvas glCanvas = new GLCanvas(glCapabilities); final JPanel container = new JPanel(new BorderLayout()); container.add(glCanvas); setLayout(new BorderLayout()); // create a button that open a new JFrame and move the GLCanvas JButton button = new JButton("Move GlCanvas to new Frame"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { final JFrame newFrame = new JFrame(); // Create a button that move back the GLCanvas to the first frame JButton closeBt = new JButton("Move Back the GLCanvas"); closeBt.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { container.add(glCanvas, BorderLayout.CENTER); glCanvas.setBounds(0,0, container.getSize().width, getSize().height); newFrame.dispose(); } }); newFrame.setSize(320, 240); newFrame.setLayout(new BorderLayout()); newFrame.add(closeBt, BorderLayout.NORTH); newFrame.add(glCanvas, BorderLayout.CENTER); newFrame.setVisible(true); } }); add(button, BorderLayout.NORTH); add(container, BorderLayout.CENTER); setSize(640, 480); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } /** * @param args the command line arguments */ public static void main(String[] args) { new JoglFrameError().setVisible(true); } }
With jogl version 2.1.1, same OS and platform configuration, the problem doesn't appear. It has been introduced in last release.
If you call setVisible(true) on the GLCanvas after newFrame.setVisible(true) it should appear again.
Probably a regression to the fix of Bug 878 jogl git commit 887dbdb34d71a3a266b7854bc9a3842aad1032f9
reproduce .. comment 3 is valid (regression)
45ce96db65fa7cbfd3bcb3dd4503bc6251d2e493 When JAWTWindow's visibility tracker updates component's local visibility, it should read it's local visibility state instead 'trusting' the passed state. Make JAWTWindow's visibility tracker DEBUG output more brief for readability. Related: Bug 816, Bug 849, Bug 729 Please re-test all unit tests related to above bugs! com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos01AWT com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos02AWT com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03aB729AWT com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03bB849AWT com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03cB849AWT com.jogamp.opengl.test.junit.jogl.awt.TestBug816JTabbedPanelVisibilityB849B878AWT com.jogamp.opengl.test.junit.jogl.awt.TestBug816GLCanvasFrameHoppingB849B889AWT com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04aAWT com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04bAWT May use scripts/tests.sh via scripts/tests-x64.sh .. etc Please reopen if recuring regression .. above tests worked fine here on GNU/Linux X11.