diff options
author | Kenneth Russel <[email protected]> | 2005-01-31 09:37:22 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-01-31 09:37:22 +0000 |
commit | df6b1b78a80fbf95e6c6e8c946bc899b75312153 (patch) | |
tree | d529decce1655f2729bcbc53333bd97b041007a5 /src/net | |
parent | 58cb43c6e0140be2f89e99743fe28a021ada9074 (diff) |
Fixed Issue 41: WindowsOffscreenGLContext failed to create with "Unable to set pixel format"
This is probably due to JOGL trying to request a double-buffered pixel
format for the offscreen surface. To prevent applications from having
to explicitly set the DoubleBuffered property of the GLCapabilities to
false, the GLCanvas now clones the incoming GLCapabilities and
disables double-buffering before requesting the underlying GLContext.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@200 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/java/games/jogl/GLCapabilities.java | 8 | ||||
-rw-r--r-- | src/net/java/games/jogl/GLJPanel.java | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/net/java/games/jogl/GLCapabilities.java b/src/net/java/games/jogl/GLCapabilities.java index 5095c802a..794f152f6 100644 --- a/src/net/java/games/jogl/GLCapabilities.java +++ b/src/net/java/games/jogl/GLCapabilities.java @@ -75,8 +75,12 @@ public class GLCapabilities implements Cloneable { */ public GLCapabilities() {} - public Object clone() throws CloneNotSupportedException { - return super.clone(); + public Object clone() { + try { + return super.clone(); + } catch (CloneNotSupportedException e) { + throw new GLException(e); + } } /** Indicates whether double-buffering is enabled. */ diff --git a/src/net/java/games/jogl/GLJPanel.java b/src/net/java/games/jogl/GLJPanel.java index 3ac5c984c..9ebec3079 100644 --- a/src/net/java/games/jogl/GLJPanel.java +++ b/src/net/java/games/jogl/GLJPanel.java @@ -86,7 +86,11 @@ public final class GLJPanel extends JPanel implements GLDrawable { GLJPanel(GLCapabilities capabilities, GLCapabilitiesChooser chooser, GLDrawable shareWith) { super(); - context = GLContextFactory.getFactory().createGLContext(null, capabilities, chooser, + // Works around problems on many vendors' cards; we don't need a + // back buffer for the offscreen surface anyway + GLCapabilities myCaps = (GLCapabilities) capabilities.clone(); + myCaps.setDoubleBuffered(false); + context = GLContextFactory.getFactory().createGLContext(null, myCaps, chooser, GLContextHelper.getContext(shareWith)); } |