diff options
Diffstat (limited to 'src/jogl/classes')
10 files changed, 70 insertions, 36 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/Debug.java b/src/jogl/classes/com/sun/opengl/impl/Debug.java index b34b8e108..b6c6e6a00 100644 --- a/src/jogl/classes/com/sun/opengl/impl/Debug.java +++ b/src/jogl/classes/com/sun/opengl/impl/Debug.java @@ -47,10 +47,12 @@ public class Debug { // Some common properties private static boolean verbose; private static boolean debugAll; + private static AccessControlContext localACC; static { - verbose = isPropertyDefined("jogl.verbose"); - debugAll = isPropertyDefined("jogl.debug"); + localACC=AccessController.getContext(); + verbose = isPropertyDefined("jogl.verbose", true); + debugAll = isPropertyDefined("jogl.debug", true); if (verbose) { Package p = Package.getPackage("javax.media.opengl"); System.err.println("JOGL specification version " + p.getSpecificationVersion()); @@ -59,34 +61,67 @@ public class Debug { } } - public static int getIntProperty(final String property, final boolean jnlpAlias) { + protected static int getIntProperty(final String property, final boolean jnlpAlias) { + return getIntProperty(property, jnlpAlias, localACC); + } + + public static int getIntProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc) { int i=0; try { - Integer iv = Integer.valueOf(Debug.getProperty(property, jnlpAlias)); + Integer iv = Integer.valueOf(Debug.getProperty(property, jnlpAlias, acc)); i = iv.intValue(); } catch (NumberFormatException nfe) {} return i; } - public static boolean getBooleanProperty(final String property, final boolean jnlpAlias) { - Boolean b = Boolean.valueOf(Debug.getProperty(property, jnlpAlias)); + protected static boolean getBooleanProperty(final String property, final boolean jnlpAlias) { + return getBooleanProperty(property, jnlpAlias, localACC); + } + + public static boolean getBooleanProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc) { + Boolean b = Boolean.valueOf(Debug.getProperty(property, jnlpAlias, acc)); return b.booleanValue(); } - public static boolean isPropertyDefined(final String property) { - return (Debug.getProperty(property, true) != null) ? true : false; + protected static boolean isPropertyDefined(final String property, final boolean jnlpAlias) { + return isPropertyDefined(property, jnlpAlias, localACC); } - public static String getProperty(final String property, final boolean jnlpAlias) { - String s = (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String val = System.getProperty(property); - if(null==val && jnlpAlias && !property.startsWith(jnlp_prefix)) { - val = System.getProperty(jnlp_prefix + property); - } - return val; + public static boolean isPropertyDefined(final String property, final boolean jnlpAlias, final AccessControlContext acc) { + return (Debug.getProperty(property, jnlpAlias, acc) != null) ? true : false; + } + + protected static String getProperty(final String property, final boolean jnlpAlias) { + return getProperty(property, jnlpAlias, localACC); + } + + public static String getProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc) { + String s=null; + if(null!=acc && acc.equals(localACC)) { + s = (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String val=null; + try { + val = System.getProperty(property); + } catch (Exception e) {} + if(null==val && jnlpAlias && !property.startsWith(jnlp_prefix)) { + try { + val = System.getProperty(jnlp_prefix + property); + } catch (Exception e) {} + } + return val; + } + }); + } else { + try { + s = System.getProperty(property); + } catch (Exception e) {} + if(null==s && jnlpAlias && !property.startsWith(jnlp_prefix)) { + try { + s = System.getProperty(jnlp_prefix + property); + } catch (Exception e) {} } - }); + } return s; } public static final String jnlp_prefix = "jnlp." ; @@ -100,6 +135,6 @@ public class Debug { } public static boolean debug(String subcomponent) { - return debugAll() || isPropertyDefined("jogl.debug." + subcomponent); + return debugAll() || isPropertyDefined("jogl.debug." + subcomponent, true); } } diff --git a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java index 63dba3ff0..eee308088 100644 --- a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java @@ -52,7 +52,7 @@ import java.lang.reflect.*; */ public final class ExtensionAvailabilityCache { private static final boolean DEBUG = Debug.debug("ExtensionAvailabilityCache"); - private static final boolean DEBUG_AVAILABILITY = Debug.isPropertyDefined("ExtensionAvailabilityCache"); + private static final boolean DEBUG_AVAILABILITY = Debug.isPropertyDefined("ExtensionAvailabilityCache", true); ExtensionAvailabilityCache(GLContextImpl context) { diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java index da0d96396..c60cccec6 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java @@ -60,7 +60,7 @@ public abstract class GLContextImpl extends GLContext { // basically had no tangible effect on the Windows or Mac OS X // platforms anyway in particular with the disabling of the // GLWorkerThread which we found to be necessary in 1.0 beta 4. - protected boolean optimizationEnabled = Debug.isPropertyDefined("jogl.GLContext.optimize"); + protected boolean optimizationEnabled = Debug.isPropertyDefined("jogl.GLContext.optimize", true); // Cache of the functions that are available to be called at the current // moment in time diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java index 95c868d00..d6ca2cbf5 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java @@ -49,7 +49,7 @@ public class GLDrawableHelper { private volatile List listeners = new ArrayList(); private static final boolean DEBUG = Debug.debug("GLDrawableHelper"); private static final boolean VERBOSE = Debug.verbose(); - private static final boolean NVIDIA_CRASH_WORKAROUND = Debug.isPropertyDefined("jogl.nvidia.crash.workaround"); + private static final boolean NVIDIA_CRASH_WORKAROUND = Debug.isPropertyDefined("jogl.nvidia.crash.workaround", true); private boolean autoSwapBufferMode = true; public GLDrawableHelper() { diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index 33fdea384..d702150d3 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -17,7 +17,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { private static boolean isTigerOrLater; static { - String osVersion = Debug.getProperty("os.version", false); + String osVersion = Debug.getProperty("os.version", false, AccessController.getContext()); StringTokenizer tok = new StringTokenizer(osVersion, ". "); int major = Integer.parseInt(tok.nextToken()); int minor = Integer.parseInt(tok.nextToken()); diff --git a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java b/src/jogl/classes/com/sun/opengl/util/texture/Texture.java index c8dda5ed5..87f045a6d 100755 --- a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/sun/opengl/util/texture/Texture.java @@ -37,6 +37,7 @@ package com.sun.opengl.util.texture; import java.nio.*; +import java.security.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; @@ -168,12 +169,14 @@ public class Texture { /** An estimate of the amount of texture memory this texture consumes. */ private int estimatedMemorySize; + private static final AccessControlContext localACC = AccessController.getContext(); + private static final boolean DEBUG = Debug.debug("Texture"); private static final boolean VERBOSE = Debug.verbose(); // For testing alternate code paths on more capable hardware - private static final boolean disableNPOT = Debug.isPropertyDefined("jogl.texture.nonpot"); - private static final boolean disableTexRect = Debug.isPropertyDefined("jogl.texture.notexrect"); + private static final boolean disableNPOT = Debug.isPropertyDefined("jogl.texture.nonpot", true, localACC); + private static final boolean disableTexRect = Debug.isPropertyDefined("jogl.texture.notexrect", true, localACC); public Texture(TextureData data) throws GLException { GL gl = GLContext.getCurrentGL(); diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java index f0450e89e..43347c416 100644 --- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java @@ -41,6 +41,7 @@ package javax.media.opengl; import javax.media.opengl.glu.*; import com.sun.opengl.impl.Debug; +import java.security.*; /** A higher-level abstraction than {@link GLDrawable} which supplies an event based mechanism ({@link GLEventListener}) for performing @@ -112,7 +113,7 @@ public interface GLAutoDrawable extends GLDrawable { /** Flag reflecting wheather the drawable reconfiguration will be issued in * case a screen device change occured, e.g. in a multihead environment, * where you drag the window to another monitor. */ - public static final boolean SCREEN_CHANGE_ACTION_ENABLED = Debug.getBooleanProperty("jogl.screenchange.action", true); + public static final boolean SCREEN_CHANGE_ACTION_ENABLED = Debug.getBooleanProperty("jogl.screenchange.action", true, AccessController.getContext()); /** FIXME: ** Invalid state, the resources are not yet ready to render. * diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index ef7fa8189..a2bff729a 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -56,8 +56,6 @@ import java.util.HashMap; refer to a given context. */ public abstract class GLContext { - protected static final boolean DEBUG = Debug.isPropertyDefined("jogl.debug.GLContext"); // Debug.debug("GLContext"); - /** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */ public static final int CONTEXT_NOT_CURRENT = 0; /** Indicates that the context was made current during the last call to {@link #makeCurrent makeCurrent}. */ @@ -180,11 +178,6 @@ public abstract class GLContext { * new GLContext implementations; not for use by end users. */ protected static void setCurrent(GLContext cur) { - if(DEBUG) { - Exception e = new Exception("setCurrent: "+Thread.currentThread()+", "+currentContext.get()+" -> "+cur); - e.printStackTrace(); - } - currentContext.set(cur); } diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 3724556db..d95d6d492 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -109,7 +109,7 @@ public abstract class GLDrawableFactory { String factoryClassName = null; tmp = null; try { - factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true); + factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true, AccessController.getContext()); if (null == factoryClassName) { if ( nativeOSType.equals(NativeWindowFactory.TYPE_EGL) ) { // use egl*Factory .. diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 5da6a892f..74da59cd3 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -110,20 +110,22 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable { // Used by all backends either directly or indirectly to hook up callbacks private Updater updater = new Updater(); + private static final AccessControlContext localACC = AccessController.getContext(); + // Turns off the pbuffer-based backend (used by default, unless the // Java 2D / OpenGL pipeline is in use) private static boolean hardwareAccelerationDisabled = - Debug.isPropertyDefined("jogl.gljpanel.nohw"); + Debug.isPropertyDefined("jogl.gljpanel.nohw", true, localACC); // Turns off the fallback to software-based rendering from // pbuffer-based rendering private static boolean softwareRenderingDisabled = - Debug.isPropertyDefined("jogl.gljpanel.nosw"); + Debug.isPropertyDefined("jogl.gljpanel.nosw", true, localACC); // Indicates whether the Java 2D OpenGL pipeline is enabled private boolean oglPipelineEnabled = Java2D.isOGLPipelineActive() && - !Debug.isPropertyDefined("jogl.gljpanel.noogl"); + !Debug.isPropertyDefined("jogl.gljpanel.noogl", true, localACC); // For handling reshape events lazily private int reshapeX; |