diff --git a/examples/nbody/.classpath b/examples/nbody/.classpath index b3420b222225e48640ac61c8d7edd93a355b79f6..4af9b71d57461025af67e8f02366407b24108d65 100644 --- a/examples/nbody/.classpath +++ b/examples/nbody/.classpath @@ -4,8 +4,9 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry combineaccessrules="false" kind="src" path="/com.amd.aparapi"/> + <classpathentry kind="var" path="JOGLDIR/jar/jogl-all-natives-windows-i586.jar"/> <classpathentry kind="var" path="JOGLDIR/jar/jogl.all.jar"/> - <classpathentry kind="var" path="JOGLDIR/jar/gluegen-rt.jar"/> - <classpathentry kind="var" path="JOGLDIR/jar/nativewindow.all.jar"/> + <classpathentry kind="lib" path="C:/Users/gfrost/jogl/gluegen-2.0-b434-20111107-windows-i586/jar/gluegen-rt.jar"/> + <classpathentry kind="lib" path="C:/Users/gfrost/jogl/gluegen-2.0-b434-20111107-windows-i586/jar/gluegen-rt-natives-windows-i586.jar"/> <classpathentry kind="output" path="classes"/> </classpath> diff --git a/examples/nbody/build.xml b/examples/nbody/build.xml index faee25e7986ac38f0e8e41ae0f7164b2f3f48949..48dc677a89d510c693ba75369b0d785d82182e74 100644 --- a/examples/nbody/build.xml +++ b/examples/nbody/build.xml @@ -1,13 +1,12 @@ <?xml version="1.0"?> <project name="nbody" default="build" basedir="."> - <property name="jogldir" value="..\..\..\..\jogl\jogl-2.0-b23-20110303-windows-i586"/> + <property name="jogamp-jar-url" value="http://jogamp.org/deployment/archive/rc/gluegen_28-joal_17-jogl_41-jocl_25/jar/"/> <path id="compiler.class.path"> <pathelement path="../../com.amd.aparapi/aparapi.jar"/> - <pathelement path="${jogldir}/jar/jogl.all.jar"/> - <pathelement path="${jogldir}/jar/nativewindow.all.jar"/> - <pathelement path="${jogldir}/jar/gluegen-rt.jar"/> + <pathelement path="lib/jogl.all.jar"/> + <pathelement path="lib/gluegen-rt.jar"/> </path> <path id="runtime.class.path" cache="true"> @@ -15,46 +14,7 @@ <pathelement path="${ant.project.name}.jar"/> </path> - <target name="check"> - <fail message="Error:"> - <condition> - <not><isset property="jogldir"/></not> - </condition> - <![CDATA[ - You will need to edit build.xml - - At present jogldir is not set. It needs to point to an jogl install directory. - ]]> - </fail> - <available file="${jogldir}" type="dir" property="jogldir.exists"/> - <fail message="Error:"> - <condition> - <not><isset property="jogldir.exists"/></not> - </condition> - <![CDATA[ - You will need to edit build.xml - - At present jogldir is set to ${jogldir} but that dir does not exist - ]]> - </fail> - <available file="${jogldir}/jar" type="dir" property="jogldir.jar.exists"/> - <available file="${jogldir}/lib" type="dir" property="jogldir.lib.exists"/> - <fail message="Error:"> - <condition> - <or> - <not><isset property="jogldir.jar.exists"/></not> - <not><isset property="jogldir.jar.exists"/></not> - </or> - </condition> - <![CDATA[ - You will need to edit build.xml - - At present jogldir is set to ${jogldir} but that does not seem to be a valid jogl install. - ]]> - </fail> - </target> - - <target name="build" depends="clean,check"> + <target name="build" depends="clean"> <mkdir dir="classes"/> <javac srcdir="src" destdir="classes" debug="on" includeantruntime="false"> <classpath refid="compiler.class.path"/> @@ -68,12 +28,14 @@ <delete file="${ant.project.name}.jar"/> </target> - - <target name="run-jtp" depends="check"> + + <target name="run-jtp"> + + <java classname="com.amd.aparapi.examples.nbody.Main" fork="true"> <classpath refid="runtime.class.path"/> - <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni:${jogldir}\lib"/> + <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni;lib"/> <sysproperty key="com.amd.aparapi.executionMode" value="JTP"/> <sysproperty key="bodies" value="16384"/> <sysproperty key="height" value="800"/> @@ -81,10 +43,10 @@ </java> </target> - <target name="run-gpu" depends="check"> + <target name="run-gpu"> <java classname="com.amd.aparapi.examples.nbody.Main" fork="true"> <classpath refid="runtime.class.path"/> - <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni:${jogldir}\lib"/> + <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni;lib"/> <sysproperty key="com.amd.aparapi.executionMode" value="GPU"/> <sysproperty key="bodies" value="16384"/> <sysproperty key="height" value="800"/> @@ -94,4 +56,107 @@ <target name="run" depends="run-gpu"/> + <target name="getjogl-windows-i586" if="use.win32"> + <delete dir="lib"/> + <get dest="lib"> + <url url="${jogamp-jar-url}/jogl-all-natives-windows-i586.jar"/> + <url url="${jogamp-jar-url}/jogl.all.jar"/> + <url url="${jogamp-jar-url}/gluegen-rt.jar"/> + <url url="${jogamp-jar-url}/gluegen-rt-natives-windows-i586.jar"/> + </get> + <unzip src="lib/jogl-all-natives-windows-i586.jar" dest="lib"/> + <unzip src="lib/gluegen-rt-natives-windows-i586.jar" dest="lib"/> + <delete dir="lib/META-INF"/> + </target> + + <target name="getjogl-windows-amd64" if="use.win64"> + <delete dir="lib"/> + <get dest="lib"> + <url url="${jogamp-jar-url}/jogl-all-natives-windows-amd64.jar"/> + <url url="${jogamp-jar-url}/gluegen-rt-natives-windows-amd64.jar"/> + </get> + <unzip src="lib/jogl-all-natives-windows-amd64.jar" dest="lib"/> + <unzip src="lib/gluegen-rt-natives-windows-amd64.jar" dest="lib"/> + <delete dir="lib/META-INF"/> + </target> + + <target name="getjogl-linux-i586" if="use.linux32"> + <delete dir="lib"/> + <get dest="lib"> + <url url="${jogamp-jar-url}/jogl-all-natives-linux-i586.jar"/> + <url url="${jogamp-jar-url}/gluegen-rt-windows-linux-i586.jar"/> + </get> + <unzip src="lib/jogl-all-natives-linux-i586.jar" dest="lib"/> + <unzip src="lib/gluegen-rt-natives-linux-i586.jar" dest="lib"/> + <delete dir="lib/META-INF"/> + </target> + + <target name="getjogl-linux-amd64" if="use.linux64"> + <delete dir="lib"/> + <get dest="lib"> + <url url="${jogamp-jar-url}/jogl-all-natives-linux-amd64.jar"/> + <url url="${jogamp-jar-url}/gluegen-rt-natives-linux-amd64.jar"/> + </get> + <unzip src="lib/jogl-all-natives-linux-amd64.jar" dest="lib"/> + <unzip src="lib/gluegen-rt-natives-linux-amd64.jar" dest="lib"/> + <delete dir="lib/META-INF"/> + </target> + + <target name="checkos"> + <condition property="use.win32"> + <and> + <os family="windows" /> + <or> + <os arch="x86" /> + <os arch="i386" /> + </or> + </and> + </condition> + <condition property="use.win64"> + <and> + <os family="windows" /> + <not> + <or> + <os arch="x86" /> + <os arch="i386" /> + </or> + </not> + </and> + </condition> + <condition property="use.linux32"> + <and> + <os family="unix" /> + <not> + <os family="mac" /> + </not> + <or> + <os arch="x86" /> + <os arch="i386" /> + </or> + </and> + </condition> + <condition property="use.linux64"> + <and> + <os family="unix" /> + <not> + <os family="mac" /> + </not> + <not> + <or> + <os arch="x86" /> + <os arch="i386" /> + </or> + </not> + </and> + </condition> + </target> + + <target name="getjogl" depends="checkos, getjogl-windows-i586, getjogl-windows-amd64, getjogl-linux-i586, getjogl-linux-amd64"> + <get dest="lib"> + <url url="${jogamp-jar-url}/jogl.all.jar"/> + <url url="${jogamp-jar-url}/gluegen-rt.jar"/> + </get> + </target> + + </project> diff --git a/examples/nbody/nbody.bat b/examples/nbody/nbody.bat index c2e4ff1b122da766e91f908d8f1764c7113b84f0..ec363229f453757510c60c27b70224564b0372ae 100644 --- a/examples/nbody/nbody.bat +++ b/examples/nbody/nbody.bat @@ -1,19 +1,12 @@ @echo off -set JOGLDIR=..\..\..\..\jogl\jogl-2.0-b23-20110303-windows-i586 - -set JOGLJARS= -set JOGLJARS=%JOGLJARS%;%JOGLDIR%\jar\jogl.all.jar -set JOGLJARS=%JOGLJARS%;%JOGLDIR%\jar\nativewindow.all.jar -set JOGLJARS=%JOGLJARS%;%JOGLDIR%\jar\gluegen-rt.jar - java ^ - -Djava.library.path=..\..\com.amd.aparapi.jni;%JOGLDIR%\lib ^ + -Djava.library.path=..\..\com.amd.aparapi.jni;lib ^ -Dcom.amd.aparapi.executionMode=%1 ^ -Dbodies=%2 ^ -Dheight=600 ^ -Dwidth=600 ^ - -classpath %JOGLJARS%;..\..\com.amd.aparapi\aparapi.jar;nbody.jar ^ + -classpath lib\gluegen-rt.jar;lib\jogl.all.jar;..\..\com.amd.aparapi\aparapi.jar;nbody.jar ^ com.amd.aparapi.examples.nbody.Main diff --git a/examples/nbody/nbody.sh b/examples/nbody/nbody.sh index 720e1016bd6191d3055ee17bcc84919a9d96cd23..4c85079c05083f9ff3ce5bbdbab912f2483dcf20 100644 --- a/examples/nbody/nbody.sh +++ b/examples/nbody/nbody.sh @@ -1,16 +1,10 @@ -export JOGLDIR=../../../../jogl/jogl-2.0-b23-20110303-linux-amd64 - -export JOGLJARS= -export JOGLJARS=${JOGLJARS}:${JOGLDIR}/jar/jogl.all.jar -export JOGLJARS=${JOGLJARS}:${JOGLDIR}/jar/nativewindow.all.jar -export JOGLJARS=${JOGLJARS}:${JOGLDIR}/jar/gluegen-rt.jar java \ - -Djava.library.path=../../com.amd.aparapi.jni:${JOGLDIR}/lib \ + -Djava.library.path=../../com.amd.aparapi.jni:lib \ -Dcom.amd.aparapi.executionMode=$1 \ -Dbodies=$1 \ -Dheight=600 \ -Dwidth=600 \ - -classpath ${JOGLJARS}:../../com.amd.aparapi/aparapi.jar:nbody.jar \ + -classpath lib/jogl.all.jar:lib/gluegen-rt.jar:../../com.amd.aparapi/aparapi.jar:nbody.jar \ com.amd.aparapi.examples.nbody.Main diff --git a/examples/nbody/src/com/amd/aparapi/examples/nbody/Main.java b/examples/nbody/src/com/amd/aparapi/examples/nbody/Main.java index cda5f49013fb5d5c636bc7222957b2f7e9999bf9..ae92a90a4c9dba7cfc7a8e12a639698c5a587e7c 100644 --- a/examples/nbody/src/com/amd/aparapi/examples/nbody/Main.java +++ b/examples/nbody/src/com/amd/aparapi/examples/nbody/Main.java @@ -287,7 +287,7 @@ public class Main{ try { InputStream textureStream = Main.class.getResourceAsStream("particle.jpg"); Texture texture = TextureIO.newTexture(textureStream, false, null); - texture.enable(); + texture.enable(gl); } catch (IOException e) { e.printStackTrace(); } catch (GLException e) {