From df6b1b78a80fbf95e6c6e8c946bc899b75312153 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 31 Jan 2005 09:37:22 +0000 Subject: 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 --- src/net/java/games/jogl/GLCapabilities.java | 8 ++++++-- src/net/java/games/jogl/GLJPanel.java | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/net') 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)); } -- cgit v1.2.3