diff options
author | Kenneth Russel <[email protected]> | 2005-06-02 22:56:14 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-06-02 22:56:14 +0000 |
commit | 90752caa7b31475d4fd424e8007ef2c9dd3851b5 (patch) | |
tree | 7fdd7426b5b02f0eefa955dbcf914e621397b5bd /src/net | |
parent | 2c06e5f46292ee7e3e4824527e1fe6cf6708df7b (diff) |
Made pbuffer code and in particular floating-point pbuffer code more
correct on Mac OS X; problems still exist, however (very likely driver
bugs)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@293 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java | 8 | ||||
-rw-r--r-- | src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java | 23 |
2 files changed, 29 insertions, 2 deletions
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java index e4fe8c4b7..272f72372 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java @@ -117,11 +117,15 @@ public abstract class MacOSXGLContext extends GLContext throw new GLException("Should not call this"); } + protected boolean create() { + return create(false, false); + } + /** * Creates and initializes an appropriate OpenGl nsContext. Should only be * called by {@link makeCurrent(Runnable)}. */ - protected boolean create() { + protected boolean create(boolean pbuffer, boolean floatingPoint) { MacOSXGLContext other = (MacOSXGLContext) GLContextShareSet.getShareContext(this); long share = 0; if (other != null) { @@ -147,6 +151,8 @@ public abstract class MacOSXGLContext extends GLContext capabilities.getAccumAlphaBits(), capabilities.getSampleBuffers() ? 1 : 0, capabilities.getNumSamples(), + (pbuffer ? 1 : 0), + (floatingPoint ? 1 : 0), viewNotReady); if (nsContext == 0) { if (viewNotReady[0] == 1) { diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java index 33658957d..93bde269b 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXPbufferGLContext.java @@ -1,10 +1,27 @@ package net.java.games.jogl.impl.macosx; +import java.security.*; +import java.util.*; + import net.java.games.jogl.*; import net.java.games.jogl.impl.*; public class MacOSXPbufferGLContext extends MacOSXGLContext { private static final boolean DEBUG = Debug.debug("MacOSXPbufferGLContext"); + private static boolean isTigerOrLater; + + static { + String osVersion = + (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty("os.version"); + } + }); + StringTokenizer tok = new StringTokenizer(osVersion, ". "); + int major = Integer.parseInt(tok.nextToken()); + int minor = Integer.parseInt(tok.nextToken()); + isTigerOrLater = ((major > 10) || (minor > 3)); + } protected int initWidth; protected int initHeight; @@ -171,7 +188,11 @@ public class MacOSXPbufferGLContext extends MacOSXGLContext { } protected boolean create() { - if (!super.create()) { + if (capabilities.getOffscreenFloatingPointBuffers() && + !isTigerOrLater) { + throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later"); + } + if (!super.create(true, capabilities.getOffscreenFloatingPointBuffers())) { return false; } created = true; |