diff options
author | Sven Gothel <[email protected]> | 2011-09-23 15:38:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-23 15:38:28 +0200 |
commit | ac358bd66878e63a370377d4c7f625ec5b1b9e31 (patch) | |
tree | 299161692f41e9efeebb88b51ddf362ecf7ee3e5 /src/jogl | |
parent | 5186899e05dd945eccbcd6fbb95781776d941bc5 (diff) |
Use Platform's initSingleton() instead of JVMUtil's (private package) ; Use TempJarCache if used.
Diffstat (limited to 'src/jogl')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLProfile.java | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index a7231efc8..f76ad5d24 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -43,9 +43,13 @@ import jogamp.opengl.GLDynamicLookupHelper; import jogamp.opengl.DesktopGLDynamicLookupHelper; import com.jogamp.common.GlueGenVersion; -import com.jogamp.common.jvm.JVMUtil; +import com.jogamp.common.jvm.JNILibLoaderBase; +import com.jogamp.common.os.Platform; +import com.jogamp.common.util.IOUtil; +import com.jogamp.common.util.JarUtil; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.common.util.VersionUtil; +import com.jogamp.common.util.cache.TempJarCache; import com.jogamp.nativewindow.NativeWindowVersion; import com.jogamp.opengl.JoglVersion; @@ -53,6 +57,7 @@ import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeWindowFactory; import javax.media.opengl.fixedfunc.GLPointerFunc; +import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashMap; @@ -107,8 +112,34 @@ public class GLProfile { initialized = true; // run the whole static initialization privileged to speed up, // since this skips checking further access - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { + if(TempJarCache.isInitialized()) { + final Class<?> c = GLProfile.class; + final ClassLoader cl = c.getClassLoader(); + try { + final String jarName = JarUtil.getJarName(c.getName(), cl); + if(DEBUG) { + System.err.println("GLProfile classURL: "+IOUtil.getClassURL(c.getName(), cl)); + System.err.println("GLProfile jarName: "+jarName); + } + if(jarName!=null) { + if( jarName.startsWith("jogl.all") ) { + // all-in-one variant + JNILibLoaderBase.addNativeJarLibs(c, "jogl-all"); + } else { + // atomic variant + JNILibLoaderBase.addNativeJarLibs(c, "nativewindow"); + JNILibLoaderBase.addNativeJarLibs(c, "jogl"); + if( ReflectionUtil.isClassAvailable("com.jogamp.newt.NewtFactory", cl) ) { + JNILibLoaderBase.addNativeJarLibs(c, "newt"); + } + } + } + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } initProfilesForDefaultDevices(firstUIActionOnProcess); return null; } @@ -1142,7 +1173,7 @@ public class GLProfile { } static { - JVMUtil.initSingleton(); + Platform.initSingleton(); } private static /*final*/ boolean isAWTAvailable; |