<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>493</bug_id>
          
          <creation_ts>2011-04-10 17:33:42 +0200</creation_ts>
          <short_desc>&quot;FBConfig null of 0x0&quot; exception when creating external GL context on CentOS 5.5 inside VMWare Server 2.0</short_desc>
          <delta_ts>2011-11-25 03:31:52 +0100</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>x11</component>
          <version>2</version>
          <rep_platform>pc_x86_64</rep_platform>
          <op_sys>linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Wade Walker">wwalker3</reporter>
          <assigned_to name="Wade Walker">wwalker3</assigned_to>
          <cc>sgothel</cc>
          
          <cf_type>---</cf_type>
          <cf_scm_refs></cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>944</commentid>
    <comment_count>0</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-04-10 17:33:42 +0200</bug_when>
    <thetext>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 &quot;OpenGL version string: 1.2 (1.5 Mesa 6.5.1)&quot;. I tried updating Mesa, but there are some dependency problems and I didn&apos;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&apos;m investigating.

java.lang.Throwable: main - Info: NativeWindowFactory.&lt;init&gt;
	at javax.media.nativewindow.NativeWindowFactory.&lt;clinit&gt;(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.&lt;clinit&gt;(OneTriangleSWT.java:29)
main - NativeWindowFactory.initSingleton(false)
Info: XInitThreads() called for concurrent Thread support
X11Util.isFirstX11ActionOnProcess: false
NativeWindowFactory.registerFactory() interface javax.media.nativewindow.NativeWindow -&gt; jogamp.nativewindow.NativeWindowFactoryImpl@79f6f296
NativeWindowFactory firstUIActionOnProcess false
NativeWindowFactory isAWTAvailable false, defaultFactory jogamp.nativewindow.NativeWindowFactoryImpl@79f6f296
GraphicsConfigurationFactory.registerFactory() class javax.media.nativewindow.x11.X11GraphicsDevice -&gt; jogamp.nativewindow.x11.X11GraphicsConfigurationFactory@13c695a6
GraphicsConfigurationFactory.registerFactory() interface javax.media.nativewindow.AbstractGraphicsDevice -&gt; jogamp.nativewindow.DefaultGraphicsConfigurationFactoryImpl@787bb290
GraphicsConfigurationFactory.registerFactory() class javax.media.nativewindow.x11.X11GraphicsDevice -&gt; jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory@27bc82e7
X11 Display(NULL) &lt;:0.0&gt;
GraphicsConfigurationFactory.registerFactory() class javax.media.nativewindow.egl.EGLGraphicsDevice -&gt; 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 &quot;main&quot; 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)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>945</commentid>
    <comment_count>1</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-04-10 17:34:25 +0200</bug_when>
    <thetext>Assigned to me, since I&apos;m checking for fixes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>946</commentid>
    <comment_count>2</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-04-10 21:11:02 +0200</bug_when>
    <thetext>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&apos;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&apos;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(&quot;X11ExternalGLXContext invalid FBCONFIG_ID &quot;+val[0]+&quot;, using default cfg: &quot; + cfg);
        }
    }
    else {
	    cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val[0]);
    }

This makes the SWT OneTriangle test pass. I&apos;ll try it on an SWT RCP app next.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>947</commentid>
    <comment_count>3</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-04-10 21:46:25 +0200</bug_when>
    <thetext>Confirmed that this works correctly for Eclipse RCP apps. Will try tomorrow on native (non-VMWare) CentOS to make sure this doesn&apos;t break the common case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>958</commentid>
    <comment_count>4</comment_count>
    <who name="Wade Walker">wwalker3</who>
    <bug_when>2011-04-13 02:35:54 +0200</bug_when>
    <thetext>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&apos;ve tested on native CentOS 5.5 with nvidia Quadro, and guest CentOS 5.5 inside VMWare with Mesa, and it works both ways.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1206</commentid>
    <comment_count>5</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2011-11-25 03:31:52 +0100</bug_when>
    <thetext>All test passed on CentOS, see bug 451, comment 3</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>