diff options
author | Sven Gothel <[email protected]> | 2009-08-02 14:00:51 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-08-02 14:00:51 -0700 |
commit | bda9e3bc462e5489aa9bc168adda438864e89ed4 (patch) | |
tree | 6a103d4dce3fd4d9fb55734bcf2fefd68f11f04f /src/jogl/classes/com/sun/opengl/impl/x11/glx | |
parent | c20b0c0b0824d6554c6881c07799b6e05d5fc09d (diff) |
Fix GLX/WGL GraphicsConfigurationFactory: Be more relaxed in error handling - keep going, even if underlying impl/modules cannot choose a config. Allows VBOX to run NEWT/JOGL
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl/x11/glx')
-rw-r--r-- | src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java index 9cb7eac08..49b56ea0e 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -215,11 +215,19 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac try { chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex); } catch (NativeWindowException e) { - throw new GLException(e); + if(DEBUG) { + e.printStackTrace(); + } + chosen = -1; } } - - if (chosen < 0 || chosen >= caps.length) { + if (chosen < 0) { + // keep on going .. + if(DEBUG) { + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig .. unable to choose config, using first"); + } + chosen = 0; // default .. + } else if (chosen >= caps.length) { throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); } @@ -255,7 +263,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac GLCapabilities[] caps = null; int recommendedIndex = -1; XVisualInfo retXVisualInfo = null; - int chosen; + int chosen=-1; NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); try { @@ -293,9 +301,18 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac try { chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex); } catch (NativeWindowException e) { - throw new GLException(e); + if(DEBUG) { + e.printStackTrace(); + } + chosen = -1; } - if (chosen < 0 || chosen >= caps.length) { + if (chosen < 0) { + // keep on going .. + if(DEBUG) { + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual .. unable to choose config, using first"); + } + chosen = 0; // default .. + } else if (chosen >= caps.length) { throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")"); } if (infos[chosen] == null) { |