How to detect if OpengGL is supported?

Hi,

I tried to load a simple Jogl program (just a Canvas in a JFrame) on a cheap Intel 82845G integrated card. The driver doesn’t support OpenGL. Is there a way to detect when this happens.

It throws me the following exception but I can’t catch it since it’s in the AWT Thread.


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at net.java.games.jogl.impl.windows.WindowsGLContextFactory.getDummyGL(WindowsGLContextFactory.java:168)
        at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(WindowsGLContext.java:288)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.create(WindowsOnscreenGLContext.java:230)
        at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:136)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:129)
        at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:246)
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.invokeGL(WindowsOnscreenGLContext.java:76)
        at net.java.games.jogl.GLCanvas$2.run(GLCanvas.java:130)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

Please try upgrading to the JSR-231 beta 1. A lot of this code has been rewritten and should be more correct now.

I think he’s asking how can you detect OGL support via query operations instead of catching an exception which is not clean in my opinion.

The exception above should not be occurring and looks like a bug which we may have worked around in a later build.