From 90752caa7b31475d4fd424e8007ef2c9dd3851b5 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Thu, 2 Jun 2005 22:56:14 +0000 Subject: 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 --- .../games/jogl/impl/macosx/MacOSXGLContext.java | 8 +++++++- .../jogl/impl/macosx/MacOSXPbufferGLContext.java | 23 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'src/net/java') 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; -- cgit v1.2.3