When I run an SWT unit test or an SWT OneTriangle test (from the wiki), I get the exception shown below. This is CentOS 5.5 64-bit, running as a guest OS inside VMWare server 2.0, running on Windows 7 64-bit. The graphics driver version from glxinfo is "OpenGL version string: 1.2 (1.5 Mesa 6.5.1)". I tried updating Mesa, but there are some dependency problems and I didn't want to break my OS installation. The problem seems to be that X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig() is returning null. When I patch it to just return the first FB config, the program runs fine. I'm investigating. java.lang.Throwable: main - Info: NativeWindowFactory.<init> at javax.media.nativewindow.NativeWindowFactory.<clinit>(NativeWindowFactory.java:119) at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1164) at javax.media.opengl.GLProfile.access$000(GLProfile.java:71) at javax.media.opengl.GLProfile$1.run(GLProfile.java:117) at java.security.AccessController.doPrivileged(Native Method) at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:115) at name.wadewalker.jogl2tests.onetriangle.OneTriangleSWT.<clinit>(OneTriangleSWT.java:29) main - NativeWindowFactory.initSingleton(false) Info: XInitThreads() called for concurrent Thread support X11Util.isFirstX11ActionOnProcess: false NativeWindowFactory.registerFactory() interface javax.media.nativewindow.NativeWindow -> jogamp.nativewindow.NativeWindowFactoryImpl@79f6f296 NativeWindowFactory firstUIActionOnProcess false NativeWindowFactory isAWTAvailable false, defaultFactory jogamp.nativewindow.NativeWindowFactoryImpl@79f6f296 GraphicsConfigurationFactory.registerFactory() class javax.media.nativewindow.x11.X11GraphicsDevice -> jogamp.nativewindow.x11.X11GraphicsConfigurationFactory@13c695a6 GraphicsConfigurationFactory.registerFactory() interface javax.media.nativewindow.AbstractGraphicsDevice -> jogamp.nativewindow.DefaultGraphicsConfigurationFactoryImpl@787bb290 GraphicsConfigurationFactory.registerFactory() class javax.media.nativewindow.x11.X11GraphicsDevice -> jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory@27bc82e7 X11 Display(NULL) <:0.0> GraphicsConfigurationFactory.registerFactory() class javax.media.nativewindow.egl.EGLGraphicsDevice -> jogamp.opengl.egl.EGLGraphicsConfigurationFactory@462ba11b java.lang.Exception: X11Util.Display: Created new NamedX11Display[:0.0, 0x45226340, refCount 1, unCloseable false]. Thread main-SharedResourceRunner at jogamp.nativewindow.x11.X11Util.createDisplay(X11Util.java:317) at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:174) at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:206) at java.lang.Thread.run(Thread.java:662) main-SharedResourceRunner - X11GraphicsDevice.setCloseDisplay(true): X11GraphicsDevice[type X11, connection :0.0, unitID 0, handle 0x45226340] chooseCapabilities: Using recommendedIndex: idx 0 Exception in thread "main" javax.media.opengl.GLException: FBConfig null of 0x0 at jogamp.opengl.x11.glx.X11GLXGraphicsConfiguration.create(X11GLXGraphicsConfiguration.java:66) at jogamp.opengl.x11.glx.X11ExternalGLXContext.create(X11ExternalGLXContext.java:78) at jogamp.opengl.x11.glx.X11GLXDrawableFactory.createExternalGLContextImpl(X11GLXDrawableFactory.java:421) at jogamp.opengl.GLDrawableFactoryImpl.createExternalGLContext(GLDrawableFactoryImpl.java:260) at name.wadewalker.jogl2tests.onetriangle.OneTriangleSWT.main(OneTriangleSWT.java:49) main-SharedResourceRunner - X11GraphicsDevice.close(): X11GraphicsDevice[type X11, connection :0.0, unitID 0, handle 0x45226340] java.lang.Exception: X11Util.Display: Closing new NamedX11Display[:0.0, 0x45226340, refCount 1, unCloseable false]. Thread main-SharedResourceRunner at jogamp.nativewindow.x11.X11Util.closeDisplay(X11Util.java:342) at javax.media.nativewindow.x11.X11GraphicsDevice.close(X11GraphicsDevice.java:96) at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.releaseSharedResource(X11GLXDrawableFactory.java:246) at jogamp.opengl.SharedResourceRunner.releaseSharedResources(SharedResourceRunner.java:245) at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:229) at java.lang.Thread.run(Thread.java:662) java.lang.Exception: X11Util.Display: Shutdown (close open / pending Displays: false, open (no close attempt): 0/0, open (no close attempt and uncloseable): 0) at jogamp.nativewindow.x11.X11Util.shutdown(X11Util.java:198) at jogamp.opengl.x11.glx.X11GLXDrawableFactory.shutdownInstance(X11GLXDrawableFactory.java:320) at javax.media.opengl.GLDrawableFactory.shutdownImpl(GLDrawableFactory.java:201) at javax.media.opengl.GLDrawableFactory.access$100(GLDrawableFactory.java:91) at javax.media.opengl.GLDrawableFactory$2.run(GLDrawableFactory.java:172) at java.lang.Thread.run(Thread.java:662)
Assigned to me, since I'm checking for fixes.
This problem is very similar to the one we had on 32-bit Windows trying to get the HDC of an external context. In this case, we can't get the framebuffer config ID of the external context. Working by analogy with the solution in WindowsExternalWGLContext.create(), I made this change in X11ExternalGLXContext.create(): X11GLXGraphicsConfiguration cfg = null; if(1 != GLX.glXQueryContext(display, ctx, GLX.GLX_FBCONFIG_ID, val, 0)) { // sometimes external contexts don't give us a framebuffer config ID; if not, // create and use a default config GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault()); cfg = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(glcapsDefault, glcapsDefault, null, x11Screen); if(DEBUG) { System.err.println("X11ExternalGLXContext invalid FBCONFIG_ID "+val[0]+", using default cfg: " + cfg); } } else { cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val[0]); } This makes the SWT OneTriangle test pass. I'll try it on an SWT RCP app next.
Confirmed that this works correctly for Eclipse RCP apps. Will try tomorrow on native (non-VMWare) CentOS to make sure this doesn't break the common case.
Submitted a fix for this at https://github.com/sgothel/jogl/pull/35 (my branch https://github.com/WadeWalker/jogl/tree/2011-04-12-fix-bug-493). I've tested on native CentOS 5.5 with nvidia Quadro, and guest CentOS 5.5 inside VMWare with Mesa, and it works both ways.
All test passed on CentOS, see bug 451, comment 3