From 25944aa4dbb86f5087718e8c9b798018d403b222 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 28 Apr 2011 00:59:02 +0200 Subject: Utilize general validation of fbcfg (further validation w/ query), refines f50f40e0fb2789537ecc19f8eaff439b24294a65 --- src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java | 5 ++--- .../classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java | 5 +++++ .../jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/x11/glx') diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index 39032117c..1b31ce16e 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -80,14 +80,13 @@ public class X11ExternalGLXContext extends X11GLXContext { // of 0, which doesn't work in a subsequent call to glXChooseFBConfig; if this happens, // create and use a default config (this has been observed when running on CentOS 5.5 inside // of VMWare Server 2.0 with the Mesa 6.5.1 drivers) - if( 0 == X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, x11Screen.getIndex(), val[0]) ) { + if( X11GLXGraphicsConfiguration.GLXFBConfigIDValid(display, x11Screen.getIndex(), val[0]) ) { 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 { + } else { cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val[0]); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index 109311123..575106555 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -207,6 +207,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } // FBConfig + + static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) { + long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid); + return (0 != fbcfg) ? X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfg ) : false ; + } static boolean GLXFBConfigValid(long display, long fbcfg) { int[] tmp = new int[1]; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java index b984f1633..e167c1467 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -218,7 +218,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF int screen = x11Screen.getIndex(); long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbID); - if( !X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfg ) ) { + if( 0 == fbcfg || !X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfg ) ) { if(DEBUG) { System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed - GLX FBConfig invalid: ("+x11Screen+","+toHexString(fbID)+"): fbcfg: "+toHexString(fbcfg)); } -- cgit v1.2.3