aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/HowToBuild.html6
-rw-r--r--doc/userguide/index.html69
-rwxr-xr-xmake/README-zip-bundles.txt2
-rw-r--r--make/build.xml110
-rw-r--r--src/classes/com/sun/opengl/impl/NativeLibLoader.java11
-rw-r--r--src/classes/com/sun/opengl/impl/x11/DRIHack.java39
-rwxr-xr-xsrc/classes/com/sun/opengl/util/JOGLAppletLauncher.java304
-rw-r--r--src/native/jogl/drihack.c59
8 files changed, 291 insertions, 309 deletions
diff --git a/doc/HowToBuild.html b/doc/HowToBuild.html
index caa6a027f..76564edd8 100644
--- a/doc/HowToBuild.html
+++ b/doc/HowToBuild.html
@@ -37,8 +37,8 @@ OpenGL binding from a fresh copy of the source distribution:
<LI>An experimental binding to the high-level <a href="http://developer.nvidia.com/view.asp?PAGE=cg_main">Cg</a> language by NVidia corporation can be generated by specifying <code>-Djogl.cg=1</code> to ant; e.g. <code>ant -Djogl.cg=1</code>. The Cg binding has been tested on Windows, Linux, and Mac OS X.
</UL>
- <LI> <B>Add JOGL to your CLASSPATH:</B> <br> To be able to use JOGL once built, you must add the build process' resulting jogl.jar (<source tree root>/build/jogl.jar) to your CLASSPATH environment variable.
- <LI> <B>Add JOGL to your PATH, LD_LIBRARY_PATH, or DYLD_LIBRARY_PATH:</B> <br> To be able to use JOGL once built, you must also add the build process's JNI code library directory (&lt;source tree root&gt;/build/obj) to your PATH (on Windows), LD_LIBRARY_PATH (on most Unix platforms), or DYLD_LIBRARY_PATH (on Mac OS X) environment variable.
+ <LI> <B>Add JOGL and the GlueGen runtime to your CLASSPATH:</B> <br> To be able to use JOGL once built, you must add the build process' resulting jogl.jar (.../jogl/build/jogl.jar) and gluegen-rt.jar (.../gluegen/build/gluegen-rt.jar) to your CLASSPATH environment variable.
+ <LI> <B>Add JOGL and the GlueGen runtime to your PATH, LD_LIBRARY_PATH, or DYLD_LIBRARY_PATH:</B> <br> To be able to use JOGL once built, you must also add the build process's JNI code library directories (.../jogl/build/obj and .../gluegen/build/obj) to your PATH (on Windows), LD_LIBRARY_PATH (on most Unix platforms), or DYLD_LIBRARY_PATH (on Mac OS X) environment variable.
<LI> <B>Test if everything's working:</B> <br> To test if everything went well, you should check out the source code for the <B>jogl-demos</B> project (available at <a href = "http://jogl-demos.dev.java.net/">http://jogl-demos.dev.java.net/</a>), build the demos using the supplied instructions, and run the Gears demo ("java demos.gears.Gears").
<LI> <B>Build Javadoc:</B> <br> "ant javadoc" will produce the end-user documentation for JOGL along with some auxiliary utility packages. The developers' documentation, including that for the GlueGen tool, can be generated for your current platform using one of the following commands: "ant javadoc.dev.win32", "ant javadoc.dev.x11", or "ant javadoc.dev.macosx". (The javadoc for the Cg binding can be built by inserting <code>-Djogl.cg=1</code> into the command line as above.)
@@ -70,7 +70,7 @@ directory of the JRE/JDK. On Windows and Linux, delete any ANTLR jars from jre/l
</OL>
-- Christopher Kline and Kenneth Russell, June 2003
+- Christopher Kline and Kenneth Russell, June 2003 (revised November 2006)
</body>
</html>
diff --git a/doc/userguide/index.html b/doc/userguide/index.html
index a76b36b5c..b3d1e408d 100644
--- a/doc/userguide/index.html
+++ b/doc/userguide/index.html
@@ -90,39 +90,42 @@ the JSR has not yet been produced.
<P>
-The JOGL distribution for developers contains two parts: a
-platform-independent JAR file containing the Java classes of the
-library (jogl.jar) and a platform-dependent native library containing
-the associated JNI code which calls OpenGL.
+The JOGL distribution for developers comes in the form of a zip
+archive which contains the Java classes to call OpenGL from Java, as
+well as the associated JNI native libraries. JOGL depends on some
+run-time support classes and native code provided by the GlueGen
+project; these classes and native code are also provided in the zip
+bundles.
</P>
<P>
-If you are developing a new application which uses JOGL, download both
-jogl.jar and the appropriate native library jar file (for example,
-jogl-natives-win32.jar). It is recommended to place both of these jar
-files in the same directory. Modify your CLASSPATH environment
-variable to include the full path to jogl.jar; for example,
-".;C:\Some\Other\Package\foo.jar;C:\Users\myhome\jogl\jogl.jar". (If
-you did not previously set the CLASSPATH environment variable, you may
-want to make sure that ".", the current directory, is on your new
-CLASSPATH.) Use the jar command which ships with the JDK to extract
-the native library jar; e.g., "jar xvf jogl-natives-win32.jar". Modify
-your PATH environment variable (Windows), LD_LIBRARY_PATH environment
-variable (Solaris and Linux), or DYLD_LIBRARY_PATH environment
-variable (Mac OS X) to contain the directory holding the new .dll, .so
-or .jnilib files. At this point your Java installation should be able
-to see the JOGL class files. Users of IDEs such as NetBeans and
-Eclipse should consult the IDE's documentation to see how to add jar
-files and native libraries to their current project.
+If you are developing a new application which uses JOGL, download the
+zip archive for your platform (for example.,
+jogl-[version]-windows-i586.zip) and unzip it. Modify your CLASSPATH
+environment variable to include the full paths to jogl.jar and
+gluegen-rt.jar; for example,
+".;C:\Some\Other\Package\foo.jar;C:\Users\myhome\jogl-[version]-windows-i586\lib\jogl.jar;C:\Users\myhome\jogl-[version]-windows-i586\lib\gluegen-rt.jar".
+(If you did not previously set the CLASSPATH environment variable, you
+may want to make sure that ".", the current directory, is on your new
+CLASSPATH.) Modify your PATH environment variable (Windows),
+LD_LIBRARY_PATH environment variable (Solaris and Linux), or
+DYLD_LIBRARY_PATH environment variable (Mac OS X) to contain the full
+path to the "lib" directory; for example, on Windows, add
+"C:\Users\myhome\jogl-[version]-windows-i586\lib" to your PATH using
+the System control panel, Advanced tab, Environment Variables
+button. At this point your Java installation should be able to see the
+JOGL class files. Users of IDEs such as NetBeans and Eclipse should
+consult the IDE's documentation to see how to add jar files and native
+libraries to their current project.
</P>
<P>
Dropping the JOGL jar and native library into the extension directory
-of the JRE is strongly discouraged. Doing so can cause conflicts with
-third-party applications launched via Java Web Start, and causes
-confusion later when upgrading the distribution.
+of the JRE is <b>strongly discouraged</b>. Doing so can cause
+conflicts with third-party applications launched via Java Web Start,
+and causes confusion later when upgrading the distribution.
</P>
@@ -148,19 +151,19 @@ the following line in the <code>&lt;resources&gt;</code> section:
</PRE>
This JNLP file points to the current JSR-231 unofficial development
-build; the JNLP file's location will change once the reference
-implementation is complete. The APIs in this release differ
-significantly from the 1.1.1 release of JOGL, which was the last
-pre-JSR release of the JOGL project. It is strongly recommended that
-applications transition to the new APIs, as the implementation is
-generally more robust than the 1.1.1 release and provides new and
-useful functionality. For reference, the stable JOGL 1.1.1 extension
-JNLP file is
+build. For reference, the extension JNLP file for the most recent
+official JSR-231 build is available at
<PRE>
- &lt;extension name="jogl" href="https://jogl.dev.java.net/webstart/jogl-1-1.jnlp" /&gt;
+ &lt;extension name="jogl" href="http://download.java.net/media/jogl/builds/archive/jsr-231-1.0.0/jogl.jnlp" /&gt;
</PRE>
+Note that before JOGL transitioned to the JSR-231 APIs, there were
+releases of the library in the <code>net.java.games.jogl</code>
+namespace under version numbers "1.0", "1.1", and "1.1.1". All of
+these releases have been superseded by JSR-231. Please update your
+applications.
+
</P>
<H3> Applet support </H3>
diff --git a/make/README-zip-bundles.txt b/make/README-zip-bundles.txt
index 83269fb56..2e5899990 100755
--- a/make/README-zip-bundles.txt
+++ b/make/README-zip-bundles.txt
@@ -24,7 +24,7 @@ and the following subdirectory:
lib contains JOGL implementation
-All of the JOGL implementation files (jar file plus native
+All of the JOGL implementation files (jar files and native
libraries) are in the lib subdirectory. For instructions on
how to use these implementation files to build or run a JOGL
program see the enclosed JOGL user guide (Userguide.html).
diff --git a/make/build.xml b/make/build.xml
index 63a6c6769..7ef5e23f4 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -354,7 +354,6 @@
<property name="compiler.cfg.id" value="compiler.cfg.linux" />
<property name="linker.cfg.id.core" value="linker.cfg.linux.jogl" />
- <property name="linker.cfg.id.drihack" value="linker.cfg.linux" />
</target>
<target name="declare.linux.amd64" if="isLinuxAMD64">
@@ -364,7 +363,6 @@
<property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" />
<property name="linker.cfg.id.core" value="linker.cfg.linux.amd64.jogl" />
- <property name="linker.cfg.id.drihack" value="linker.cfg.linux" />
</target>
<target name="declare.linux.ia64" if="isLinuxIA64">
@@ -374,7 +372,6 @@
<property name="compiler.cfg.id" value="compiler.cfg.linux" />
<property name="linker.cfg.id.core" value="linker.cfg.linux.jogl" />
- <property name="linker.cfg.id.drihack" value="linker.cfg.linux" />
</target>
<target name="declare.linux" depends="declare.linux.x86,declare.linux.amd64,declare.linux.ia64,declare.x11" if="isLinux" />
@@ -386,7 +383,6 @@
<property name="compiler.cfg.id" value="compiler.cfg.solaris" />
<property name="linker.cfg.id.core" value="linker.cfg.solaris.jogl" />
- <property name="linker.cfg.id.drihack" value="linker.cfg.solaris" />
</target>
@@ -397,7 +393,6 @@
<property name="compiler.cfg.id" value="compiler.cfg.solaris.sparcv9" />
<property name="linker.cfg.id.core" value="linker.cfg.solaris.sparcv9.jogl" />
- <property name="linker.cfg.id.drihack" value="linker.cfg.solaris.sparcv9" />
</target>
@@ -408,7 +403,6 @@
<property name="compiler.cfg.id" value="compiler.cfg.solaris.amd64" />
<property name="linker.cfg.id.core" value="linker.cfg.solaris.amd64.jogl" />
- <property name="linker.cfg.id.drihack" value="linker.cfg.solaris.amd64" />
</target>
@@ -446,7 +440,6 @@
<property name="compiler.cfg.id" value="compiler.cfg.freebsd.jogl" />
<property name="linker.cfg.id.core" value="linker.cfg.linux.jogl" />
- <property name="linker.cfg.id.drihack" value="linker.cfg.linux" />
</target>
<target name="declare.hpux" depends="declare.x11" if="isHPUX">
@@ -455,7 +448,6 @@
<property name="java.lib.dir.platform" value="${java.lib.dir.hpux}" />
<property name="compiler.cfg.id" value="compiler.cfg.hpux" />
<property name="linker.cfg.id.core" value="linker.cfg.hpux.jogl" />
- <property name="linker.cfg.id.drihack" value="linker.cfg.hpux" />
</target>
<!-- ================================================================== -->
@@ -494,12 +486,6 @@
<propertyref name="gluegen.nsig" />
</propertyset>
</ant>
-
- <!-- Extract the GlueGen runtime classes into our build directory.
- - We currently bundle them into jogl.jar; they could be kept in
- - a separate jar, but this makes deployment simpler.
- -->
- <unjar src="${gluegen-rt.jar}" dest="${classes}" />
</target>
<!--
@@ -700,6 +686,7 @@
<!-- Perform the first pass Java compile. -->
<javac srcdir="${src.generated.java}"
destdir="${classes}"
+ classpath="${gluegen-rt.jar}"
includes="javax/media/opengl/GL.java"
fork="yes"
memoryMaximumSize="128m"
@@ -711,6 +698,7 @@
<!-- Perform the second pass Java compile; everything. -->
<javac destdir="${classes}"
excludes="${java.excludes.platform},com/sun/opengl/impl/nurbs/**" source="${jogl.sourcelevel}"
+ classpath="${gluegen-rt.jar}"
fork="yes"
memoryMaximumSize="128m"
debug="true" debuglevel="source,lines">
@@ -808,10 +796,6 @@
<include name="${rootrel.generated.c.jogl}/JAWT*.c"/>
</patternset>
- <patternset id="c.src.files.jogl.drihack">
- <include name="${rootrel.src.c.jogl}/drihack.c"/>
- </patternset>
-
<patternset id="c.src.files.cg">
<include name="${rootrel.generated.c.cg}/*.c"/>
</patternset>
@@ -933,14 +917,6 @@
</antcall>
</target>
- <target name="c.build.jogl.drihack" if="isX11">
- <antcall target="c.build" inheritRefs="true">
- <param name="c.compiler.src.files" value="c.src.files.jogl.drihack"/>
- <param name="output.lib.name" value="jogl_drihack"/>
- <param name="linker.cfg.id" value="${linker.cfg.id.drihack}"/>
- </antcall>
- </target>
-
<target name="c.manifest" if="isVC8Family">
<!-- exec mt, the Microsoft Manifest Tool, to include DLL manifests in order to resolve the location of msvcr80.dll -->
<exec executable="mt">
@@ -955,7 +931,7 @@
</exec>
</target>
- <target name="c.build.jogl" depends="c.build.jogl.core,c.build.jogl.awt,c.build.jogl.drihack,c.build.jogl.cg">
+ <target name="c.build.jogl" depends="c.build.jogl.core,c.build.jogl.awt,c.build.jogl.cg">
<antcall target="c.rename.jogl.libs.mingw" inheritRefs="true" />
<antcall target="c.rename.jogl.libs.macosx" inheritRefs="true" />
<antcall target="c.manifest" inheritRefs="true" />
@@ -1133,6 +1109,8 @@
<available file="${jogl.dist.dir}/jogl-win/32/jogl.dll" />
<available file="${jogl.dist.dir}/jogl-win/32/jogl_awt.dll" />
<available file="${jogl.dist.dir}/jogl-win/32/jogl_cg.dll" />
+ <available file="${jogl.dist.dir}/jogl-win/32/gluegen-rt.dll" />
+ <available file="${jogl.dist.dir}/jogl-win/32/gluegen-rt-natives-windows-i586.jar" />
</and>
</condition>
<fail unless="windows.complete">
@@ -1151,6 +1129,8 @@
<available file="${jogl.dist.dir}/jogl-linux/32/libjogl.so" />
<available file="${jogl.dist.dir}/jogl-linux/32/libjogl_awt.so" />
<available file="${jogl.dist.dir}/jogl-linux/32/libjogl_cg.so" />
+ <available file="${jogl.dist.dir}/jogl-linux/32/libgluegen-rt.so" />
+ <available file="${jogl.dist.dir}/jogl-linux/32/gluegen-rt-natives-linux-i586.jar" />
<!-- Assume we also copy over these generated files in the Linux build -->
<!-- in order to satisfy requests from end users that we provide these -->
<!-- files for easier source browsing in IDEs -->
@@ -1175,6 +1155,8 @@
<available file="${jogl.dist.dir}/jogl-linux/64/libjogl.so" />
<available file="${jogl.dist.dir}/jogl-linux/64/libjogl_awt.so" />
<available file="${jogl.dist.dir}/jogl-linux/64/libjogl_cg.so" />
+ <available file="${jogl.dist.dir}/jogl-linux/64/libgluegen-rt.so" />
+ <available file="${jogl.dist.dir}/jogl-linux/64/gluegen-rt-natives-linux-amd64.jar" />
</and>
</condition>
<fail unless="linux.complete">
@@ -1193,6 +1175,8 @@
<available file="${jogl.dist.dir}/jogl-macosx/ppc/libjogl.jnilib" />
<available file="${jogl.dist.dir}/jogl-macosx/ppc/libjogl_awt.jnilib" />
<available file="${jogl.dist.dir}/jogl-macosx/ppc/libjogl_cg.jnilib" />
+ <available file="${jogl.dist.dir}/jogl-macosx/ppc/libgluegen-rt.jnilib" />
+ <available file="${jogl.dist.dir}/jogl-macosx/ppc/gluegen-rt-natives-macosx-ppc.jar" />
</and>
</condition>
<fail unless="macosx.complete">
@@ -1212,6 +1196,8 @@
<available file="${jogl.dist.dir}/jogl-macosx/fat/libjogl.jnilib" />
<available file="${jogl.dist.dir}/jogl-macosx/fat/libjogl_awt.jnilib" />
<available file="${jogl.dist.dir}/jogl-macosx/fat/libjogl_cg.jnilib" />
+ <available file="${jogl.dist.dir}/jogl-macosx/fat/libgluegen-rt.jnilib" />
+ <available file="${jogl.dist.dir}/jogl-macosx/fat/gluegen-rt-natives-macosx-universal.jar" />
</and>
</condition>
<fail unless="macosxfat.complete">
@@ -1231,7 +1217,8 @@
<available file="${jogl.dist.dir}/jogl-solsparc/jogl.jar" />
<available file="${jogl.dist.dir}/jogl-solsparc/32/libjogl.so" />
<available file="${jogl.dist.dir}/jogl-solsparc/32/libjogl_awt.so" />
- <available file="${jogl.dist.dir}/jogl-solsparc/32/libjogl_drihack.so" />
+ <available file="${jogl.dist.dir}/jogl-solsparc/32/libgluegen-rt.so" />
+ <available file="${jogl.dist.dir}/jogl-solsparc/32/gluegen-rt-natives-solaris-sparc.jar" />
</and>
</condition>
<fail unless="solsparc.complete">
@@ -1249,7 +1236,8 @@
<available file="${jogl.dist.dir}/jogl-solsparc/jogl.jar" />
<available file="${jogl.dist.dir}/jogl-solsparc/64/libjogl.so" />
<available file="${jogl.dist.dir}/jogl-solsparc/64/libjogl_awt.so" />
- <available file="${jogl.dist.dir}/jogl-solsparc/64/libjogl_drihack.so" />
+ <available file="${jogl.dist.dir}/jogl-solsparc/64/libgluegen-rt.so" />
+ <available file="${jogl.dist.dir}/jogl-solsparc/64/gluegen-rt-natives-solaris-sparcv9.jar" />
</and>
</condition>
<fail unless="solsparcv9.complete">
@@ -1267,7 +1255,8 @@
<available file="${jogl.dist.dir}/jogl-solx86/jogl.jar" />
<available file="${jogl.dist.dir}/jogl-solx86/32/libjogl.so" />
<available file="${jogl.dist.dir}/jogl-solx86/32/libjogl_awt.so" />
- <available file="${jogl.dist.dir}/jogl-solx86/32/libjogl_drihack.so" />
+ <available file="${jogl.dist.dir}/jogl-solx86/32/libgluegen-rt.so" />
+ <available file="${jogl.dist.dir}/jogl-solx86/32/gluegen-rt-natives-solaris-i586.jar" />
</and>
</condition>
<fail unless="solx86.complete">
@@ -1284,7 +1273,8 @@
<and>
<available file="${jogl.dist.dir}/jogl-solx86/64/libjogl.so" />
<available file="${jogl.dist.dir}/jogl-solx86/64/libjogl_awt.so" />
- <available file="${jogl.dist.dir}/jogl-solx86/64/libjogl_drihack.so" />
+ <available file="${jogl.dist.dir}/jogl-solx86/64/libgluegen-rt.so" />
+ <available file="${jogl.dist.dir}/jogl-solx86/64/gluegen-rt-natives-solaris-amd64.jar" />
</and>
</condition>
<fail unless="solamd64.complete">
@@ -1308,9 +1298,10 @@
<mkdir dir="${jogl.dist.dir}/tmp/${jogl.tmp.version}/lib" />
<!-- Copy in files -->
<copy todir="${jogl.dist.dir}/tmp/${jogl.tmp.version}/lib">
- <fileset dir="${zip.src.so.dir}" includes="*" />
+ <fileset dir="${zip.src.so.dir}" includes="*${zip.so.suffix}" />
</copy>
<copy file="${jogl.dist.dir}/jogl.jar" todir="${jogl.dist.dir}/tmp/${jogl.tmp.version}/lib" />
+ <copy file="${jogl.dist.dir}/gluegen-rt.jar" todir="${jogl.dist.dir}/tmp/${jogl.tmp.version}/lib" />
<copy file="../COPYRIGHT.txt" todir="${jogl.dist.dir}/tmp/${jogl.tmp.version}" />
<copy file="../LICENSE.txt" tofile="${jogl.dist.dir}/tmp/${jogl.tmp.version}/LICENSE-JOGL-${tmp.version}.txt" />
<copy file="README-zip-bundles.txt"
@@ -1328,9 +1319,8 @@
</target>
<target name="dist" depends="dist.dir.check,dist.check.windows,dist.check.linux,dist.check.linux-amd64,dist.check.macosx,dist.check.macosxfat,dist.check.solsparc,dist.check.solsparcv9,dist.check.solx86, dist.check.solamd64">
- <delete file="${jogl.dist.dir}/jogl.jar" />
<delete>
- <fileset dir="${jogl.dist.dir}" includes="jogl-natives-*.jar" />
+ <fileset dir="${jogl.dist.dir}" includes="*.jar" />
</delete>
<delete>
<fileset dir="${jogl.dist.dir}" includes="*.zip" />
@@ -1360,10 +1350,10 @@
includes="jogl.dll,jogl_awt.dll,jogl_cg.dll" />
<jar destfile="${jogl.dist.dir}/jogl-natives-linux-i586.jar"
basedir="${jogl.dist.dir}/jogl-linux/32"
- includes="libjogl.so,libjogl_awt.so,libjogl_cg.so,libjogl_drihack.so" />
+ includes="libjogl.so,libjogl_awt.so,libjogl_cg.so" />
<jar destfile="${jogl.dist.dir}/jogl-natives-linux-amd64.jar"
basedir="${jogl.dist.dir}/jogl-linux/64"
- includes="libjogl.so,libjogl_awt.so,libjogl_cg.so,libjogl_drihack.so" />
+ includes="libjogl.so,libjogl_awt.so,libjogl_cg.so" />
<jar destfile="${jogl.dist.dir}/jogl-natives-macosx-ppc.jar"
basedir="${jogl.dist.dir}/jogl-macosx/ppc"
includes="libjogl.jnilib,libjogl_awt.jnilib,libjogl_cg.jnilib" />
@@ -1372,16 +1362,47 @@
includes="libjogl.jnilib,libjogl_awt.jnilib,libjogl_cg.jnilib" />
<jar destfile="${jogl.dist.dir}/jogl-natives-solaris-sparc.jar"
basedir="${jogl.dist.dir}/jogl-solsparc/32"
- includes="libjogl.so,libjogl_awt.so,libjogl_drihack.so" />
+ includes="libjogl.so,libjogl_awt.so" />
<jar destfile="${jogl.dist.dir}/jogl-natives-solaris-sparcv9.jar"
basedir="${jogl.dist.dir}/jogl-solsparc/64"
- includes="libjogl.so,libjogl_awt.so,libjogl_drihack.so" />
+ includes="libjogl.so,libjogl_awt.so" />
<jar destfile="${jogl.dist.dir}/jogl-natives-solaris-i586.jar"
basedir="${jogl.dist.dir}/jogl-solx86/32"
- includes="libjogl.so,libjogl_awt.so,libjogl_drihack.so" />
+ includes="libjogl.so,libjogl_awt.so" />
<jar destfile="${jogl.dist.dir}/jogl-natives-solaris-amd64.jar"
basedir="${jogl.dist.dir}/jogl-solx86/64"
- includes="libjogl.so,libjogl_awt.so,libjogl_drihack.so" />
+ includes="libjogl.so,libjogl_awt.so" />
+ <!-- Copy gluegen-rt.jar from Linux build (arbitrary; this jar is platform-independent) -->
+ <copy file="${jogl.dist.dir}/jogl-linux/gluegen-rt.jar" todir="${jogl.dist.dir}" />
+ <!-- Copy gluegen-rt native jars out of platform-specific subdirectories -->
+ <copy todir="${jogl.dist.dir}">
+ <fileset dir="${jogl.dist.dir}/jogl-win/32" includes="gluegen-natives-*.jar" />
+ </copy>
+ <copy todir="${jogl.dist.dir}">
+ <fileset dir="${jogl.dist.dir}/jogl-linux/32" includes="gluegen-natives-*.jar" />
+ </copy>
+ <copy todir="${jogl.dist.dir}">
+ <fileset dir="${jogl.dist.dir}/jogl-linux/64" includes="gluegen-natives-*.jar" />
+ </copy>
+ <copy todir="${jogl.dist.dir}">
+ <fileset dir="${jogl.dist.dir}/jogl-macosx/ppc" includes="gluegen-natives-*.jar" />
+ </copy>
+ <copy todir="${jogl.dist.dir}">
+ <fileset dir="${jogl.dist.dir}/jogl-macosx/fat" includes="gluegen-natives-*.jar" />
+ </copy>
+ <copy todir="${jogl.dist.dir}">
+ <fileset dir="${jogl.dist.dir}/jogl-solsparc/32" includes="gluegen-natives-*.jar" />
+ </copy>
+ <copy todir="${jogl.dist.dir}">
+ <fileset dir="${jogl.dist.dir}/jogl-solsparc/64" includes="gluegen-natives-*.jar" />
+ </copy>
+ <copy todir="${jogl.dist.dir}">
+ <fileset dir="${jogl.dist.dir}/jogl-solx86/32" includes="gluegen-natives-*.jar" />
+ </copy>
+ <copy todir="${jogl.dist.dir}">
+ <fileset dir="${jogl.dist.dir}/jogl-solx86/64" includes="gluegen-natives-*.jar" />
+ </copy>
+
<!-- Build a source archive as well -->
<!-- First copy the generated files out of the Linux build results into the appropriate -->
<!-- directory of this source tree (so that they'll be blown away properly with an -->
@@ -1403,38 +1424,47 @@
target in order to get the platform-independent jogl.jar. -->
<antcall target="dist.build.zip" inheritAll="true">
<param name="zip.os.arch" value="linux-i586" />
+ <param name="zip.so.suffix" value=".so" />
<param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-linux/32" />
</antcall>
<antcall target="dist.build.zip" inheritAll="true">
<param name="zip.os.arch" value="linux-amd64" />
+ <param name="zip.so.suffix" value=".so" />
<param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-linux/64" />
</antcall>
<antcall target="dist.build.zip" inheritAll="true">
<param name="zip.os.arch" value="macosx-ppc" />
+ <param name="zip.so.suffix" value=".jnilib" />
<param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-macosx/ppc" />
</antcall>
<antcall target="dist.build.zip" inheritAll="true">
<param name="zip.os.arch" value="macosx-universal" />
+ <param name="zip.so.suffix" value=".jnilib" />
<param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-macosx/fat" />
</antcall>
<antcall target="dist.build.zip" inheritAll="true">
<param name="zip.os.arch" value="solaris-i586" />
+ <param name="zip.so.suffix" value=".so" />
<param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-solx86/32" />
</antcall>
<antcall target="dist.build.zip" inheritAll="true">
<param name="zip.os.arch" value="solaris-amd64" />
+ <param name="zip.so.suffix" value=".so" />
<param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-solx86/64" />
</antcall>
<antcall target="dist.build.zip" inheritAll="true">
<param name="zip.os.arch" value="solaris-sparc" />
+ <param name="zip.so.suffix" value=".so" />
<param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-solsparc/32" />
</antcall>
<antcall target="dist.build.zip" inheritAll="true">
<param name="zip.os.arch" value="solaris-sparcv9" />
+ <param name="zip.so.suffix" value=".so" />
<param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-solsparc/64" />
</antcall>
<antcall target="dist.build.zip" inheritAll="true">
<param name="zip.os.arch" value="windows-i586" />
+ <param name="zip.so.suffix" value=".dll" />
<param name="zip.src.so.dir" value="${jogl.dist.dir}/jogl-win/32" />
</antcall>
<!-- Create one last zip archive by hand, this one containing all of the -->
diff --git a/src/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/classes/com/sun/opengl/impl/NativeLibLoader.java
index 25c52e594..aa5c4e236 100644
--- a/src/classes/com/sun/opengl/impl/NativeLibLoader.java
+++ b/src/classes/com/sun/opengl/impl/NativeLibLoader.java
@@ -133,17 +133,6 @@ public class NativeLibLoader {
});
}
- // See DRIHack.java in com/sun/opengl/impl/x11/ for description of
- // why this is needed
- public static void loadDRIHack() {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- loadLibrary("jogl_drihack", null, false, false);
- return null;
- }
- });
- }
-
public static void loadCgImpl() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
diff --git a/src/classes/com/sun/opengl/impl/x11/DRIHack.java b/src/classes/com/sun/opengl/impl/x11/DRIHack.java
index 18bf3d5e8..f6579238e 100644
--- a/src/classes/com/sun/opengl/impl/x11/DRIHack.java
+++ b/src/classes/com/sun/opengl/impl/x11/DRIHack.java
@@ -41,6 +41,7 @@ package com.sun.opengl.impl.x11;
import java.io.*;
import java.security.*;
+import com.sun.gluegen.runtime.*;
import com.sun.opengl.impl.*;
/**
@@ -70,19 +71,15 @@ import com.sun.opengl.impl.*;
* necessary in any other situation than with the DRI drivers. Another
* solution is to force the first load of libGL.so.1.2 to be done
* dynamically with RTLD_GLOBAL before libjogl.so is loaded and causes
- * libGL.so.1.2 to be loaded again. This requires the C APIs dlopen
- * and dlclose to be made available before libjogl.so is loaded. This
- * is the solution currently chosen and is called the "DRI hack"
- * because again it is needed only in this situation.
+ * libGL.so.1.2 to be loaded again. The NativeLibrary class in the
+ * GlueGen runtime has this property, and we use it to implement this
+ * workaround.
*/
public class DRIHack {
- public static native long dlopen(String name);
- public static native int dlclose(long handle);
-
private static final boolean DEBUG = Debug.debug("DRIHack");
private static boolean driHackNeeded;
- private static long libGLHandle;
+ private static NativeLibrary oglLib;
public static void begin() {
AccessController.doPrivileged(new PrivilegedAction() {
@@ -102,34 +99,30 @@ public class DRIHack {
System.err.println("Beginning DRI hack");
}
- NativeLibLoader.loadDRIHack();
// Try a few different variants for best robustness
// In theory probably only the first is necessary
- libGLHandle = dlopen("libGL.so.1");
- if (DEBUG && libGLHandle != 0) System.err.println(" Found libGL.so.1");
- if (libGLHandle == 0) {
- libGLHandle = dlopen("libGL.so.1.2");
- if (DEBUG && libGLHandle != 0) System.err.println(" Found libGL.so.1.2");
- }
+ oglLib = NativeLibrary.open("GL", null);
+ if (DEBUG && oglLib != null) System.err.println(" Found libGL.so");
// Allow ATI's fglrx to supersede version in /usr/lib
- if (libGLHandle == 0) {
- libGLHandle = dlopen("/usr/lib/ati-fglrx/libGL.so.1.2");
- if (DEBUG && libGLHandle != 0) System.err.println(" Found /usr/lib/ati-fglrx/libGL.so.1.2");
+ if (oglLib == null) {
+ oglLib = NativeLibrary.open("/usr/lib/ati-fglrx/libGL.so.1.2", null);
+ if (DEBUG && oglLib != null) System.err.println(" Found /usr/lib/ati-fglrx/libGL.so.1.2");
}
- if (libGLHandle == 0) {
- libGLHandle = dlopen("/usr/lib/libGL.so.1");
- if (DEBUG && libGLHandle != 0) System.err.println(" Found /usr/lib/libGL.so.1");
+ if (oglLib == null) {
+ oglLib = NativeLibrary.open("/usr/lib/libGL.so.1", null);
+ if (DEBUG && oglLib != null) System.err.println(" Found /usr/lib/libGL.so.1");
}
}
}
public static void end() {
- if (libGLHandle != 0) {
+ if (oglLib != null) {
if (DEBUG) {
System.err.println("Ending DRI hack");
}
- dlclose(libGLHandle);
+ oglLib.close();
+ oglLib = null;
}
}
}
diff --git a/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java b/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java
index 303985b69..2f3237275 100755
--- a/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java
+++ b/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java
@@ -53,6 +53,7 @@ import java.applet.AppletContext;
import java.io.*;
import java.net.*;
import java.security.cert.*;
+import java.text.*;
import java.util.*;
import java.util.jar.*;
import javax.swing.*;
@@ -65,13 +66,15 @@ import javax.media.opengl.*;
* It may also be used to deploy signed applets in which case
* multiple security dialogs will be displayed. <p>
*
- * On the server side the codebase must contain jogl.jar and all of
- * the jogl-natives-*.jar files from the standard JOGL distribution.
- * This is the location from which the JOGL library used by the
- * applet is downloaded. The codebase additionally contains the jar
- * file of the user's potentially untrusted applet. The jogl.jar and
- * all jogl-natives jars must be signed by the same entity, which is
- * typically Sun Microsystems, Inc.
+ * On the server side the codebase must contain jogl.jar ,
+ * gluegen-rt.jar, and all of the jogl-natives-*.jar and
+ * gluegen-rt-natives-*.jar files from the standard JOGL distribution
+ * (provided in jogl-[version]-webstart.zip). This is the location
+ * from which the JOGL library used by the applet is downloaded. The
+ * codebase additionally contains the jar file of the user's
+ * potentially untrusted applet. All of the JOGL and GlueGen-related
+ * jars must be signed by the same entity, which is typically Sun
+ * Microsystems, Inc.
*
* Sample applet code:
* <pre>
@@ -79,12 +82,12 @@ import javax.media.opengl.*;
* width=600
* height=400
* codebase="/lib"
- * archive="jogl.jar,your_applet.jar"&gt;
+ * archive="jogl.jar,gluegen-rt.jar,your_applet.jar"&gt;
* &lt;param name="subapplet.classname" VALUE="untrusted.JOGLApplet"&gt;
* &lt;param name="subapplet.displayname" VALUE="My JOGL Applet"&gt;
* &lt;param name="progressbar" value="true"&gt;
- * &lt;param name="cache_archive" VALUE="jogl.jar,your_applet.jar"&gt;
- * &lt;param name="cache_archive_ex" VALUE="jogl.jar;preload,your_applet.jar;preload"&gt;
+ * &lt;param name="cache_archive" VALUE="jogl.jar,gluegen-rt.jar,your_applet.jar"&gt;
+ * &lt;param name="cache_archive_ex" VALUE="jogl.jar;preload,gluegen-rt.jar;preload,your_applet.jar;preload"&gt;
* &lt;/applet&gt;
* </pre>
* <p>
@@ -108,8 +111,8 @@ import javax.media.opengl.*;
* this applet launcher, the first question to ask the end user is
* whether jogl.jar and any associated DLLs, .so's, etc. are installed
* directly in to the JRE. The applet launcher has been tested
- * primarily under Mozilla and Firefox; there may be problems when
- * running under, for example, Opera. <p>
+ * primarily under Mozilla, Firefox and Internet Explorer; there may
+ * be problems when running under, for example, Opera. <p>
*
* @author Lilian Chamontin
* @author Kenneth Russell
@@ -126,37 +129,37 @@ public class JOGLAppletLauncher extends Applet {
private static class NativeLibInfo {
private String osName;
private String osArch;
- private String nativeJar;
+ private String osNameAndArchPair;
private String nativePrefix;
private String nativeSuffix;
- public NativeLibInfo(String osName, String osArch, String nativeJar, String nativePrefix, String nativeSuffix) {
+ public NativeLibInfo(String osName, String osArch, String osNameAndArchPair, String nativePrefix, String nativeSuffix) {
this.osName = osName;
this.osArch = osArch;
- this.nativeJar = nativeJar;
+ this.osNameAndArchPair = osNameAndArchPair;
this.nativePrefix = nativePrefix;
this.nativeSuffix = nativeSuffix;
}
public boolean matchesOSAndArch(String osName, String osArch) {
- if (osName.startsWith(this.osName)) {
+ if (osName.toLowerCase().startsWith(this.osName)) {
if ((this.osArch == null) ||
- (osArch.startsWith(this.osArch))) {
+ (osArch.toLowerCase().startsWith(this.osArch))) {
return true;
}
}
return false;
}
- public boolean matchesNativeLib(String nativeLibraryName) {
- if (nativeLibraryName.toLowerCase().endsWith(nativeSuffix)) {
+ public boolean matchesNativeLib(String fileName) {
+ if (fileName.toLowerCase().endsWith(nativeSuffix)) {
return true;
}
return false;
}
- public String getNativeJarName() {
- return nativeJar;
+ public String formatNativeJarName(String nativeJarPattern) {
+ return MessageFormat.format(nativeJarPattern, new Object[] { osNameAndArchPair });
}
public String getNativeLibName(String baseName) {
@@ -166,16 +169,20 @@ public class JOGLAppletLauncher extends Applet {
public boolean isMacOS() {
return (osName.equals("mac"));
}
+
+ public boolean mayNeedDRIHack() {
+ return (!isMacOS() && !osName.equals("win"));
+ }
}
private static final NativeLibInfo[] allNativeLibInfo = {
- new NativeLibInfo("win", "x86", "jogl-natives-windows-i586.jar", "", ".dll"),
- new NativeLibInfo("mac", "ppc", "jogl-natives-macosx-ppc.jar", "lib", ".jnilib"),
- new NativeLibInfo("mac", "i386", "jogl-natives-macosx-universal.jar", "lib", ".jnilib"),
- new NativeLibInfo("linux", "i386", "jogl-natives-linux-i586.jar", "lib", ".so"),
- new NativeLibInfo("linux", "x86", "jogl-natives-linux-i586.jar", "lib", ".so"),
- new NativeLibInfo("sunos", "sparc", "jogl-natives-solaris-sparc.jar", "lib", ".so"),
- new NativeLibInfo("sunos", "x86", "jogl-natives-solaris-i586.jar", "lib", ".so")
+ new NativeLibInfo("win", "x86", "windows-i586", "", ".dll"),
+ new NativeLibInfo("mac", "ppc", "macosx-ppc", "lib", ".jnilib"),
+ new NativeLibInfo("mac", "i386", "macosx-universal", "lib", ".jnilib"),
+ new NativeLibInfo("linux", "i386", "linux-i586", "lib", ".so"),
+ new NativeLibInfo("linux", "x86", "linux-i586", "lib", ".so"),
+ new NativeLibInfo("sunos", "sparc", "solaris-sparc", "lib", ".so"),
+ new NativeLibInfo("sunos", "x86", "solaris-i586", "lib", ".so")
};
private NativeLibInfo nativeLibInfo;
@@ -183,10 +190,6 @@ public class JOGLAppletLauncher extends Applet {
// The signatures of these native libraries are checked before
// installing them.
private String[] nativeLibNames;
- // Whether the "DRI hack" native library is present and whether we
- // therefore might need to run the DRIHack during loading of the
- // native libraries
- private boolean driHackPresent;
/** The applet we have to start */
private Applet subApplet;
@@ -236,8 +239,8 @@ public class JOGLAppletLauncher extends Applet {
this.installDirectory = codeBase.replace(':', '_')
.replace('.', '_').replace('/', '_').replace('~','_'); // clean up the name
- String osName = System.getProperty("os.name").toLowerCase();
- String osArch = System.getProperty("os.arch").toLowerCase();
+ String osName = System.getProperty("os.name");
+ String osArch = System.getProperty("os.arch");
if (checkOSAndArch(osName, osArch)) {
this.isInitOk = true;
} else {
@@ -245,12 +248,30 @@ public class JOGLAppletLauncher extends Applet {
}
}
- private void displayMessage(String message){
- progressBar.setString(message);
+ private void displayMessage(final String message){
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ progressBar.setString(message);
+ }
+ });
+ }
+
+ private void displayError(final String errorMessage){
+ // Print message to Java console too in case it's truncated in the applet's display
+ System.err.println(errorMessage);
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ progressBar.setString("Error : " + errorMessage);
+ }
+ });
}
- private void displayError(String errorMessage){
- progressBar.setString("Error : " + errorMessage);
+ private void setProgress(final int value) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ progressBar.setValue(value);
+ }
+ });
}
private void initLoaderLayout(){
@@ -368,110 +389,110 @@ public class JOGLAppletLauncher extends Applet {
}
}
- String nativeJarName = nativeLibInfo.getNativeJarName();
+ String[] nativeJarNames = new String[] {
+ nativeLibInfo.formatNativeJarName("jogl-natives-{0}.jar"),
+ nativeLibInfo.formatNativeJarName("gluegen-rt-natives-{0}.jar")
+ };
- URL nativeLibURL;
- URLConnection urlConnection;
- String path = getCodeBase().toExternalForm() + nativeJarName;
- try {
- nativeLibURL = new URL(path);
- urlConnection = nativeLibURL.openConnection();
- } catch (Exception e){
- e.printStackTrace();
- displayError("Couldn't access the native lib URL : " + path);
- return;
- }
+ for (int n = 0; n < nativeJarNames.length; n++) {
+ String nativeJarName = nativeJarNames[n];
- // the timestamp used to determine if we have to download the native jar again
- // don't rely on the OS's timestamp to cache this
- long lastModified = getTimestamp(installDir, urlConnection.getLastModified());
- if (lastModified != urlConnection.getLastModified()) {
- displayMessage("Updating local version of the native libraries");
- // first download the full jar locally
- File localJarFile = new File(installDir, nativeJarName);
+ URL nativeLibURL;
+ URLConnection urlConnection;
+ String path = getCodeBase().toExternalForm() + nativeJarName;
try {
- saveNativesJarLocally(localJarFile, urlConnection);
- } catch (IOException ioe) {
- ioe.printStackTrace();
- displayError("Unable to install the native file locally");
- return;
+ nativeLibURL = new URL(path);
+ urlConnection = nativeLibURL.openConnection();
+ } catch (Exception e){
+ e.printStackTrace();
+ displayError("Couldn't access the native lib URL : " + path);
+ return;
}
- try {
- JarFile jf = new JarFile(localJarFile);
-
- // Iterate the entries finding all candidate libraries that need
- // to have their signatures verified
- if (!findNativeEntries(jf)) {
- displayError("native libraries not found in jar file");
- return;
- }
-
- byte[] buf = new byte[8192];
-
- // Go back and verify the signatures
- for (int i = 0; i < nativeLibNames.length; i++) {
- JarEntry entry = jf.getJarEntry(nativeLibNames[i]);
- if (entry == null) {
- displayError("error looking up jar entry " + nativeLibNames[i]);
- return;
- }
- if (!checkNativeCertificates(jf, entry, buf)) {
- displayError("Native library " + nativeLibNames[i] + " isn't properly signed or has other errors");
- return;
- }
- }
-
- // Now install the native library files
- progressBar.setValue(0);
- for (int i = 0; i < nativeLibNames.length; i++) {
- displayMessage("Installing native files");
- if (!installFile(installDir, jf, nativeLibNames[i], buf)) {
- return;
- }
- int percent = (100 * (i + 1) / nativeLibNames.length);
- progressBar.setValue(percent);
- }
-
- // At this point we can delete the jar file we just downloaded
- jf.close();
- localJarFile.delete();
-
- // If installation succeeded, write a timestamp for all of the
- // files to be checked next time
- try {
- File timestampFile = new File(installDir, "timestamp");
- timestampFile.delete();
- BufferedWriter writer = new BufferedWriter(new FileWriter(timestampFile));
- writer.write("" + urlConnection.getLastModified());
- writer.flush();
- writer.close();
- } catch (Exception e) {
- displayError("Error writing time stamp for native libraries");
- return;
- }
-
- } catch (Exception e) {
- displayError("Error opening jar file " + localJarFile.getName() + " for reading");
- return;
- }
- } else {
- // Still need to discover whether DRI hack is installed
- File[] files = installDir.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].getName().indexOf("jogl_drihack") >= 0) {
- driHackPresent = true;
- }
+ // the timestamp used to determine if we have to download the native jar again
+ // don't rely on the OS's timestamp to cache this
+ long lastModified = getTimestamp(installDir, nativeJarName, urlConnection.getLastModified());
+ if (lastModified != urlConnection.getLastModified()) {
+ displayMessage("Updating local version of the native libraries");
+ // first download the full jar locally
+ File localJarFile = new File(installDir, nativeJarName);
+ try {
+ saveNativesJarLocally(localJarFile, urlConnection);
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ displayError("Unable to install the native file locally");
+ return;
+ }
+
+ try {
+ JarFile jf = new JarFile(localJarFile);
+
+ // Iterate the entries finding all candidate libraries that need
+ // to have their signatures verified
+ if (!findNativeEntries(jf)) {
+ displayError("native libraries not found in jar file");
+ return;
+ }
+
+ byte[] buf = new byte[8192];
+
+ // Go back and verify the signatures
+ for (int i = 0; i < nativeLibNames.length; i++) {
+ JarEntry entry = jf.getJarEntry(nativeLibNames[i]);
+ if (entry == null) {
+ displayError("error looking up jar entry " + nativeLibNames[i]);
+ return;
+ }
+ if (!checkNativeCertificates(jf, entry, buf)) {
+ displayError("Native library " + nativeLibNames[i] + " isn't properly signed or has other errors");
+ return;
+ }
+ }
+
+ // Now install the native library files
+ setProgress(0);
+ for (int i = 0; i < nativeLibNames.length; i++) {
+ displayMessage("Installing native files from " + nativeJarName);
+ if (!installFile(installDir, jf, nativeLibNames[i], buf)) {
+ return;
+ }
+ int percent = (100 * (i + 1) / nativeLibNames.length);
+ setProgress(percent);
+ }
+
+ // At this point we can delete the jar file we just downloaded
+ jf.close();
+ localJarFile.delete();
+
+ // If installation succeeded, write a timestamp for all of the
+ // files to be checked next time
+ try {
+ File timestampFile = new File(installDir, "timestamp");
+ timestampFile.delete();
+ BufferedWriter writer = new BufferedWriter(new FileWriter(timestampFile));
+ writer.write("" + urlConnection.getLastModified());
+ writer.flush();
+ writer.close();
+ } catch (Exception e) {
+ displayError("Error writing time stamp for native libraries");
+ return;
+ }
+
+ } catch (Exception e) {
+ displayError("Error opening jar file " + localJarFile.getName() + " for reading");
+ return;
+ }
}
}
loadNativesAndStart(installDir);
}
- private long getTimestamp(File installDir, long timestamp) {
+ private long getTimestamp(File installDir, String nativeJarName, long timestamp) {
// Avoid returning valid value if timestamp file doesn't exist
try {
- BufferedReader reader = new BufferedReader(new FileReader(new File(installDir, "timestamp")));
+ String timestampName = "timestamp-" + nativeJarName.replace('.', '-');
+ BufferedReader reader = new BufferedReader(new FileReader(new File(installDir, timestampName)));
try {
StreamTokenizer tokenizer = new StreamTokenizer(reader);
// Avoid screwing up by not being able to read full longs
@@ -497,7 +518,7 @@ public class JOGLAppletLauncher extends Applet {
BufferedOutputStream out = null;;
InputStream in = null;
displayMessage("Downloading native library");
- progressBar.setValue(0);
+ setProgress(0);
try {
out = new BufferedOutputStream(new
FileOutputStream(localJarFile));
@@ -510,7 +531,7 @@ public class JOGLAppletLauncher extends Applet {
out.write(buffer, 0, len);
sum += len;
int percent = (100 * sum / totalLength);
- progressBar.setValue(percent);
+ setProgress(percent);
}
out.close();
in.close();
@@ -538,9 +559,6 @@ public class JOGLAppletLauncher extends Applet {
JarEntry entry = (JarEntry) e.nextElement();
if (nativeLibInfo.matchesNativeLib(entry.getName())) {
list.add(entry.getName());
- if (entry.getName().indexOf("jogl_drihack") >= 0) {
- driHackPresent = true;
- }
}
}
if (list.isEmpty()) {
@@ -632,13 +650,21 @@ public class JOGLAppletLauncher extends Applet {
public void run() {
displayMessage("Loading native libraries");
- // disable JOGL loading from elsewhere
+ // disable JOGL and GlueGen runtime library loading from elsewhere
com.sun.opengl.impl.NativeLibLoader.disableLoading();
+ com.sun.gluegen.runtime.NativeLibLoader.disableLoading();
+
+ // Open GlueGen runtime library optimistically. Note that
+ // currently we do not need this on any platform except X11
+ // ones, because JOGL doesn't use the GlueGen NativeLibrary
+ // class anywhere except the DRIHack class, but if for
+ // example we add JOAL support then we will need this on
+ // every platform.
+ loadLibrary(nativeLibDir, "gluegen-rt");
Class driHackClass = null;
- if (driHackPresent) {
- // Load DRI hack library and run the DRI hack itself
- loadLibrary(nativeLibDir, "jogl_drihack");
+ if (nativeLibInfo.mayNeedDRIHack()) {
+ // Run the DRI hack
try {
driHackClass = Class.forName("com.sun.opengl.impl.x11.DRIHack");
driHackClass.getMethod("begin", new Class[] {}).invoke(null, new Object[] {});
@@ -650,7 +676,7 @@ public class JOGLAppletLauncher extends Applet {
// Load core JOGL native library
loadLibrary(nativeLibDir, "jogl");
- if (driHackPresent) {
+ if (nativeLibInfo.mayNeedDRIHack()) {
// End DRI hack
try {
driHackClass.getMethod("end", new Class[] {}).invoke(null, new Object[] {});
diff --git a/src/native/jogl/drihack.c b/src/native/jogl/drihack.c
deleted file mode 100644
index 912b11800..000000000
--- a/src/native/jogl/drihack.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-#include <jni.h>
-
-#include <inttypes.h>
-#include <dlfcn.h>
-
-JNIEXPORT jlong JNICALL
-Java_com_sun_opengl_impl_x11_DRIHack_dlopen(JNIEnv* env, jclass unused, jstring name) {
- const jbyte* chars;
- void* res;
- chars = (*env)->GetStringUTFChars(env, name, NULL);
- res = dlopen(chars, RTLD_LAZY | RTLD_GLOBAL);
- (*env)->ReleaseStringUTFChars(env, name, chars);
- return (jlong) ((intptr_t) res);
-}
-
-JNIEXPORT int JNICALL
-Java_com_sun_opengl_impl_x11_DRIHack_dlclose(JNIEnv* env, jclass unused, jlong handle)
-{
- return dlclose((void*) ((intptr_t) handle));
-}