Problem with GLJPanel

Doing the following with a GLJPanel I get the GLException that can be found below. I actually thought it was a problem with my driver but using a GLCanvas everything works fine. I tried with jdk1.5.0,1.5.0_01, 1.4.2_05.

-stephan

GLCapabilities capabilities = new GLCapabilities();
JPanel panel = GLDrawableFactory.getFactory().createGLJPanel(capabilities);

    JFrame frame = new JFrame("OpenGL Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    frame.setSize(400,400);
    frame.add(panel);
    frame.setVisible(true);

Exception in thread “main” net.java.games.jogl.GLException: Unable to set pixel format
at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(WindowsGLContext.java:493)
at net.java.games.jogl.impl.windows.WindowsOffscreenGLContext.create(WindowsOffscreenGLContext.java:181)
at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:135)
at net.java.games.jogl.impl.windows.WindowsOffscreenGLContext.makeCurrent(WindowsOffscreenGLContext.java:128)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:250)
at net.java.games.jogl.GLJPanel.reshape(GLJPanel.java:131)
at java.awt.Component.setBounds(Component.java:1847)
at java.awt.BorderLayout.layoutContainer(BorderLayout.java:809)
at java.awt.Container.layout(Container.java:1401)
at java.awt.Container.doLayout(Container.java:1390)
at java.awt.Container.validateTree(Container.java:1473)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validate(Container.java:1448)
at java.awt.Window.show(Window.java:507)
at java.awt.Component.show(Component.java:1300)
at java.awt.Component.setVisible(Component.java:1253)

I think the GLJPanel implementation has bit-rotted since it was first written. On my current notebook, the last time I checked, running the JGears demo resulted in a blue screen of death. (Can’t retest right now.) It’s possible that recent restructurings have made the code either buggy or much more demanding on the correctness of OpenGL drivers. Either way you should feel free to file a bug about this using the Issue Tracker off the JOGL home page.

Try turning double buffering off in GLCapabilities (default is on), before constructing GLJPanel. It worked for me…

I hope that hardware accelerated GLJPanel will be available soon…

Mantesat,

Thanks! I just found this threat cuz I was dealing with the exact same problem as snagy did, and your advice fixed it for me. I was starting to think I wouldn’t be able to use OGL on this project at all!

Ken

Note: the current builds of JOGL hide this detail. I would recommend you upgrade to pick up the hardware acceleration support for GLJPanel as well as correctness fixes for the GLJPanel and other areas.