diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 68c21b84c..d97e0e201 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -42,7 +42,6 @@ package jogamp.opengl; import java.lang.reflect.Method; import java.nio.IntBuffer; -import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashMap; import java.util.IdentityHashMap; @@ -55,6 +54,7 @@ import com.jogamp.common.os.DynamicLookupHelper; import com.jogamp.common.os.Platform; import com.jogamp.common.util.Bitfield; import com.jogamp.common.util.ReflectionUtil; +import com.jogamp.common.util.SecurityUtil; import com.jogamp.common.util.VersionNumber; import com.jogamp.common.util.VersionNumberString; import com.jogamp.common.util.locks.RecursiveLock; @@ -86,6 +86,29 @@ import com.jogamp.opengl.GLPipelineFactory; import com.jogamp.opengl.GLProfile; public abstract class GLContextImpl extends GLContext { + + /** Selected {@link Platform.OSType#MACOS} or {@link Platform.OSType#IOS} {@link VersionNumber}s. */ + public static class MacOSVersion { + /** OSX Lion, i.e. 10.7.0 */ + public static final VersionNumber Lion; + /** OSX Mavericks, i.e. 10.9.0 */ + public static final VersionNumber Mavericks; + /** OSX Mojave, i.e. 10.14.0 */ + public static final VersionNumber Mojave; + + static { + if( Platform.getOSType() == Platform.OSType.MACOS ) { + Lion = new VersionNumber(10,7,0); + Mavericks = new VersionNumber(10,9,0); + Mojave = new VersionNumber(10,14,0); + } else { + Lion = null; + Mavericks = null; + Mojave = null; + } + } + } + /** * Context full qualified name: display_type + display_connection + major + minor + ctp. * This is the key for all cached GL ProcAddressTables, etc, to support multi display/device setups. @@ -1022,7 +1045,8 @@ public abstract class GLContextImpl extends GLContext { this.preCtxVersion = preCtxVersion; this.preCtxOptions = preCtxOptions; } - public final String toString() { + @Override + public final String toString() { return toString(new StringBuilder(), -1, -1, -1, -1).toString(); } public final StringBuilder toString(final StringBuilder sb, final int minMajor, final int minMinor, final int maxMajor, final int maxMinor) { @@ -1226,7 +1250,7 @@ public abstract class GLContextImpl extends GLContext { // ensuring proper user behavior across platforms due to different feature sets! // if( Platform.OSType.MACOS == Platform.getOSType() && - Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Mavericks) >= 0 ) { + Platform.getOSVersionNumber().compareTo(MacOSVersion.Mavericks) >= 0 ) { /** * OSX 10.9 GLRendererQuirks.GL4NeedsGL3Request, quirk is added as usual @ setRendererQuirks(..) */ @@ -1621,7 +1645,7 @@ public abstract class GLContextImpl extends GLContext { GLEmitter by looking up anew all of its function pointers using the given {@link GLDynamicLookupHelper}. */ protected final void resetProcAddressTable(final ProcAddressTable table, final GLDynamicLookupHelper dlh) { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { table.reset( dlh ); @@ -1777,7 +1801,7 @@ public abstract class GLContextImpl extends GLContext { final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice(); if( !glGetPtrInit ) { - AccessController.doPrivileged(new PrivilegedAction<Object>() { + SecurityUtil.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { final GLDynamicLookupHelper glDynLookupHelper = getGLDynamicLookupHelper(reqMajor, reqCtxProfileBits); @@ -2323,7 +2347,7 @@ public abstract class GLContextImpl extends GLContext { } quirks.addQuirk( quirk ); } - if( Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Mavericks) >= 0 && 3==reqMajor && 4==hasMajor ) { + if( Platform.getOSVersionNumber().compareTo(MacOSVersion.Mavericks) >= 0 && 3==reqMajor && 4==hasMajor ) { final int quirk = GLRendererQuirks.GL4NeedsGL3Request; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber()+", req "+reqMajor+"."+reqMinor); @@ -2339,7 +2363,7 @@ public abstract class GLContextImpl extends GLContext { } quirks.addQuirk( quirk ); } - if( Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Lion) < 0 ) { // < OSX 10.7.0 w/ NV has unstable GLSL + if( Platform.getOSVersionNumber().compareTo(MacOSVersion.Lion) < 0 ) { // < OSX 10.7.0 w/ NV has unstable GLSL final int quirk = GLRendererQuirks.GLSLNonCompliant; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber()+", Renderer "+glRenderer); @@ -2665,7 +2689,7 @@ public abstract class GLContextImpl extends GLContext { throw new GLException("No GLDynamicLookupHelper for "+this); } final String tmpBase = GLNameResolver.normalizeVEN(GLNameResolver.normalizeARB(glFunctionName, true), true); - return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { + return SecurityUtil.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { boolean res = false; |