This code doesn’t work :
public class TestJOGL extends JFrame
{
public static void main(String[] args) throws InterruptedException
{
JFrame frame = new JFrame();
frame.setSize(640, 480);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
GLCanvas canvas = new GLCanvas(new GLCapabilities(GLProfile.get(GLProfile.GL2)));
frame.add(canvas);
frame.setVisible(true);
}
}
The GLCanvas is not displayed, the JFrame is white.
But this code works :
public class TestJOGL extends JFrame
{
public static void main(String[] args) throws InterruptedException
{
JFrame frame = new JFrame();
frame.setSize(640, 480);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
GLCanvas canvas = new GLCanvas(new GLCapabilities(GLProfile.get(GLProfile.GL2)));
frame.setVisible(true);
frame.add(canvas); // add after the "setVisible"
}
}
The GLCanvas is displayed, the JFrame is black.
Use Swing and AWT components is not recommended, but, is it a bug ?