Login  Register

Re: GLCanvas/GLJPanel problems

Posted by mikaelhc on Nov 20, 2012; 3:45pm
URL: https://forum.jogamp.org/GLCanvas-GLJPanel-problems-tp4026923p4027080.html

I still get the "Unable to create temp OpenGL context for device context" errors.

I wrap everything in an 'invokeLater' call, and, as I understand it, the OpenGL thread should invoke methods on the EDT thread, right?

For instance, the following code crashes when moving the splitter:

public class JoglTest extends JFrame {	
	private static final long serialVersionUID = 1L;

	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
		    public void run() {
		    	new JoglTest();
		    }
		});			
	}
	
	public JoglTest() {
		Container contentPane = getContentPane();
		
		JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
		splitPane.setResizeWeight(0.5d);

		GLCanvas gc = new GLCanvas(new GLCapabilities(GLProfile.getDefault()));
		splitPane.setLeftComponent(gc);
		splitPane.setRightComponent(new JPanel());		
		contentPane.add(splitPane, BorderLayout.CENTER);

		FPSAnimator animator = new FPSAnimator(gc, 100);
		animator.start();
		
		pack();
		setVisible(true);
		setSize(new java.awt.Dimension(824,568));
	}
}

The code works on Mac, and earlier versions of JOGL.

Isn't this a JOGL bug? Or am I missing something?