Boolean j3dSortShape3DBounds = (Boolean) java.security.AccessController.doPrivileged( new java.security.PrivilegedAction() { public Object run() { String str = System.getProperty("j3d.sortShape3DBounds"); if (str == null) { return Boolean.FALSE; } else { return Boolean.TRUE; } } }); sortShape3DBounds = j3dSortShape3DBounds.booleanValue(); if (sortShape3DBounds) { System.err.println("Java 3D: Shape3D bounds enabled for transparency sorting"); }
    MasterControl() {	// Get AWT handle	awt = getAWT();	// Get native API information	nativeAPIInfo = new NativeAPIInfo();	renderingAPI = nativeAPIInfo.getRenderingAPI();	isD3DAPI = (renderingAPI == RENDER_DIRECT3D);        isWin32 = isD3DAPI || (renderingAPI == RENDER_OPENGL_WIN32);	if(J3dDebug.devPhase) {	    // Check to see whether debug mode is allowed	    Boolean j3dDebug =		(Boolean) java.security.AccessController.doPrivileged(		    new java.security.PrivilegedAction() {		    public Object run() {			String str = System.getProperty("j3d.debug", "false");			return new Boolean(str);		    }		});	    J3dDebug.debug = j3dDebug.booleanValue();	    	    // Get graphic library.	    //System.err.println("In Development Phase : \n");	    	    if(renderingAPI == RENDER_OPENGL_SOLARIS)		System.err.print("Graphics Library : Solaris OpenGL");	    else if(renderingAPI == RENDER_OPENGL_WIN32)		System.err.print("Graphics Library : Win32 OpenGL");	    else if(renderingAPI == RENDER_DIRECT3D)		System.err.println("Graphics Library : Direct3D");	    System.err.println();	    // Get package info.	    ClassLoader classLoader = getClass().getClassLoader();	    if (classLoader != null) {		// it is null in case of plugin		J3dDebug.pkgInfo(classLoader, "javax.media.j3d",				 "SceneGraphObject");	    } 	    if(J3dDebug.debug) {		J3dDebug.pkgInfo(classLoader, "javax.vecmath", "Point3d");		J3dDebug.pkgInfo(classLoader, "com.sun.j3d.utils.universe", "SimpleUniverse");				// Reminder statement.		System.err.println("For production release : Set J3dDebug.devPhase to false.\n");		System.err.println("MasterControl: J3dDebug.debug = " + J3dDebug.debug);	    }	}	// Check to see whether shared contexts are allowed	if (getRenderingAPI() != RENDER_DIRECT3D) {	    Boolean j3dSharedCtx =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty("j3d.sharedctx");			      if (str == null) {				  return Boolean.FALSE;			      } else {				  sharedCtxOverride = true;				  return new Boolean(str);			      }			  }		      });	    isSharedCtx = j3dSharedCtx.booleanValue();	    if (sharedCtxOverride) {		if (isSharedCtx) 		    System.err.println("Java 3D: shared contexts enabled");		else		    System.err.println("Java 3D: shared contexts disabled");	    }	}	Boolean j3dDisableCompile =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty("j3d.disablecompile");			      if (str == null) {				  return Boolean.FALSE;			      } else {				  return Boolean.TRUE;			      }			  }		      });	disableCompile = j3dDisableCompile.booleanValue();	if (disableCompile) {	    System.err.println("Java 3D: Compile disabled");	}	Boolean j3dDoCompaction =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty("j3d.docompaction");			      if (str == null) {				  return Boolean.TRUE;			      } else {				  return Boolean.FALSE;			      }			  }		      });	doCompaction = j3dDoCompaction.booleanValue();	if (!doCompaction) {	    System.err.println("Java 3D: Disabling compaction.");	}	Boolean j3dUseCombiners =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty("j3d.usecombiners");			      if (str == null) {				  return Boolean.FALSE;			      } else {				  return Boolean.TRUE;			      }			  }		      });	useCombiners = j3dUseCombiners.booleanValue();	if (useCombiners) {	    System.err.println("Java 3D: Using NV_register_combiners if available");	}	Boolean j3dDisableSeparateSpecularColor =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty(					     "j3d.disableSeparateSpecular");			      if (str == null) {				  return Boolean.FALSE;			      } else {				  return Boolean.TRUE;			      }			  }		      });	disableSeparateSpecularColor = 		j3dDisableSeparateSpecularColor.booleanValue();	if (disableSeparateSpecularColor) {	    System.err.println(		"Java 3D: Separate Specular Color disabled if possible");	}	// Get the maximum number of texture units	final int defaultTextureUnitMax = textureUnitMax;	Integer textureUnitLimit =	    (Integer) java.security.AccessController.doPrivileged(	    new java.security.PrivilegedAction() {		public Object run() {		    return Integer.getInteger("j3d.textureUnitMax",					      defaultTextureUnitMax);		}	    });	textureUnitMax = textureUnitLimit.intValue();	if (textureUnitMax != defaultTextureUnitMax) {	    System.err.println("Java 3D: maximum number of texture units = " +			       textureUnitMax);	}	Boolean j3dDisplayList =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty("j3d.displaylist", "true");			      return new Boolean(str);			  }		      });	isDisplayList = j3dDisplayList.booleanValue();	if (!isDisplayList) {	    System.err.println("Java 3D: Display List disabled");	}	Boolean j3dimplicitAntialiasing =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty("j3d.implicitAntialiasing", "false");			      return new Boolean(str);			  }		      });	implicitAntialiasing = j3dimplicitAntialiasing.booleanValue();	if (implicitAntialiasing) {	    System.err.println("Java 3D: Implicit Antialiasing enabled");	}	Boolean j3dcompliedVertexArray =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty("j3d.compliedVertexArray", "true");			      return new Boolean(str);			  }		      });	isCompliedVertexArray = j3dcompliedVertexArray.booleanValue();	if (!isCompliedVertexArray) {	    System.err.println("Java 3D: Complied vertex array disabled");	}	Boolean j3dforceNormalized =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty("j3d.forceNormalized", "false");			      return new Boolean(str);			  }		      });	isForceNormalized = j3dforceNormalized.booleanValue();	if (isForceNormalized) {	    System.err.println("Java 3D: Force Normalized");	}	Boolean j3dOptimizeSpace =		(Boolean) java.security.AccessController.doPrivileged(		      new java.security.PrivilegedAction() {                          public Object run() {			      String str = System.getProperty("j3d.optimizeForSpace", "true");			      return new Boolean(str);			  }		});	if (!j3dOptimizeSpace.booleanValue()) {	    System.err.println("Java 3D: Optimize For Space disabled");	}	    	// Build Display list for by-ref geometry and infrequently changing geometry	// ONLY IF (isDisplayList is true and optimizeForSpace if False)	if (isDisplayList && !j3dOptimizeSpace.booleanValue()) {	    buildDisplayListIfPossible = true;	}	else {	    buildDisplayListIfPossible = false;	}	// Check to see whether Renderer can run without DSI lock	Boolean j3dRenderLock =	    (Boolean) java.security.AccessController.doPrivileged(	    new java.security.PrivilegedAction() {		public Object run() {		    String str = System.getProperty("j3d.renderLock", "false");		    return new Boolean(str);		}	    });	doDsiRenderLock = j3dRenderLock.booleanValue();        // Don't print this out now that the default is false	//if (!doDsiRenderLock) {	//    System.err.println("Java 3D: render lock disabled");	//}	// Check to see whether J3DGraphics2D uses texturemapping	// or drawpixel for composite the buffers	Boolean j3dG2DRender =	    (Boolean) java.security.AccessController.doPrivileged(	           new java.security.PrivilegedAction() {		     public Object run() {			 String str = System.getProperty("j3d.g2ddrawpixel", "false");			return new Boolean(str);		     }		   });	isJ3dG2dDrawPixel = j3dG2DRender.booleanValue();	if(J3dDebug.devPhase) {	    if (!isJ3dG2dDrawPixel) {		System.err.println("Java 3D: render Graphics2D DrawPixel disabled");	    } else {		System.err.println("Java 3D: render Graphics2D DrawPixel enabled");	    }	}	// Check to see whether BackgroundRetained uses texturemapping	// or drawpixel clear the background	if (!isD3D()) {	    Boolean j3dBackgroundTexture =		(Boolean) java.security.AccessController.doPrivileged(	           new java.security.PrivilegedAction() {		     public Object run() {			 String str = System.getProperty("j3d.backgroundtexture", "true");			return new Boolean(str);		     }		   });	    isBackgroundTexture = j3dBackgroundTexture.booleanValue();	    if(J3dDebug.devPhase) {		if (!isBackgroundTexture) {		    System.err.println("Java 3D: background texture is disabled");		} else {		    System.err.println("Java 3D: background texture is enabled");		}	    }	} else {	    // D3D always use background texture and use	    // canvas.clear() instead of canvas.textureclear() in Renderer	    isBackgroundTexture = false;	}	        // Check to see if stereo mode is sharing the Z-buffer for both        // eyes.        Boolean j3dSharedStereoZBuffer =            (Boolean) java.security.AccessController.doPrivileged(            new java.security.PrivilegedAction() {                public Object run() {		    String defaultValue = (isWin32 ? "true" : "false");                    String str = System.getProperty("j3d.sharedstereozbuffer",						    defaultValue);                    return new Boolean(str);                }            });        sharedStereoZBuffer = j3dSharedStereoZBuffer.booleanValue();        j3dSharedStereoZBuffer = null;	// Get the maximum number of concurrent threads (CPUs)	final int defaultThreadLimit = getNumberOfProcessor()+1;	Integer threadLimit =	    (Integer) java.security.AccessController.doPrivileged(	    new java.security.PrivilegedAction() {		public Object run() {		    return Integer.getInteger("j3d.threadLimit",					      defaultThreadLimit);		}	    });	cpuLimit = threadLimit.intValue();	if (cpuLimit < 1)	    cpuLimit = 1;	if (J3dDebug.debug || cpuLimit != defaultThreadLimit) {	    System.err.println("Java 3D: concurrent threadLimit = " +			       cpuLimit);	}	// Ensure that there are at least enough system threads to	// support all of Java 3D's threads running in parallel	int threadConcurrency = getThreadConcurrency();	if (J3dDebug.debug) {	    System.err.println("System threadConcurrency = " +			       threadConcurrency);	}	if (threadConcurrency != -1 && threadConcurrency < (cpuLimit + 1)) {	    threadConcurrency = cpuLimit + 1;	    if (J3dDebug.debug) {		System.err.println("Setting system threadConcurrency to " +				   threadConcurrency);	    }	    setThreadConcurrency(threadConcurrency);	}	// Get the input device scheduler sampling time	Integer samplingTime  =	    (Integer) java.security.AccessController.doPrivileged(	    new java.security.PrivilegedAction() {		public Object run() {		    return Integer.getInteger("j3d.deviceSampleTime", 0);		}	    });		if (samplingTime.intValue() > 0) {	    InputDeviceScheduler.samplingTime =		samplingTime.intValue();	    System.err.println("Java 3D: Input device sampling time = "			       + samplingTime + " ms");	}	// See if Xinerama should be disabled for better performance.	Boolean j3dDisableXinerama =	    (Boolean) java.security.AccessController.doPrivileged(	    new java.security.PrivilegedAction() {		public Object run() {		    String str = System.getProperty("j3d.disableXinerama",						    "false");		    return new Boolean(str);		}	    });	boolean disableXinerama = j3dDisableXinerama.booleanValue();	// Initialize the native J3D library	if (!initializeJ3D(disableXinerama)) {	    if (isGreenThreadUsed()) {	        System.err.print(J3dI18N.getString("MasterControl1"));	    }	    throw new RuntimeException(J3dI18N.getString("MasterControl0"));	}	if (xineramaDisabled) {	    // initializeJ3D() successfully disabled Xinerama.	    System.err.println("Java 3D: Xinerama disabled");	}	else if (disableXinerama) {	    // j3d.disableXinerama is true, but attempt failed.	    System.err.println("Java 3D: could not disable Xinerama");	}	// Get the maximum Lights	maxLights = getMaximumLights();	// create the freelists	FreeListManager.createFreeLists();    }