Posted by
gavanw on
Sep 14, 2010; 3:10am
URL: https://forum.jogamp.org/Michael-Bien-s-Particle-System-get-it-up-and-running-tp1470332.html
Michael (edit:
my mistake, not Michael, but Demoscene Passivist) posted up a particle system example here:
http://copypastaresearch.tumblr.com/post/1072015050/ported-my-first-experiments-in-gpu-based-particleAnd, as linked to you can get the full source here (with other useful examples):
http://github.com/demoscenepassivist/SocialCoding/tree/master/code_demos_jogampSince I ran into a lot of trouble compiling/running these examples from Eclipse, I thought I would share my solution. I am not sure this is the best way to do this, but it worked for me. (FYI I am using windows 7 64 bit with eclipse, java, and jogl 64 bit)
1) Make sure you can get JOGL up and running following Tutorial 1, 2, and 3 here:
http://jogamp.org/wiki/index.php/Jogl_Tutorial. Also, make sure you have the JDK installed (NOT just the JRE). (JDK = Java Development Kit, JRE = Java Runtime Environment). This is important if you want to make JAR files through the command prompt.
2) Once you have a project with these succesfully running, click "download source" on:
http://github.com/demoscenepassivist/SocialCoding/tree/master/code_demos_jogampand extract it to a directory.
3) Drag the contents of code_demos_jogamp (this would be the folders binaries, build, libraries, etc) from Windows explorer into eclipse on the "src" folder in the Package Explorer window. Make sure to copy the files into the physical project directory and overwrite everything.
4) In eclipse, delete the old example package if it is in there (package "windows", containing class "SimpleScene"), and delete the contents from the disk as well.
5) In windows explorer, find the file "\build\Jogamp_Standalone_JOGL_GL3_BasicParticleSystem.bat" and copy it into the project root ([eclipse workspace]\[project name])
6) You can take a look at this file by right clicking it and selecting "edit"...as you can see, the project batch file expects you to copy java into the local directory runtime -- I would advise against this and just make sure that java is in your system PATH variable (Mike might have a reason for this though). Once the java bin folder is in your system path, you can change the batch file to look like the following (make sure the directories are correct, mine are probably different from yours (most notably, it is expecting that eclipse generates your output to ".\bin"):
echo on
cd .
jar cvfm .\jogamp.jar MANIFEST.MF -C .\bin . .\shaders
java.exe -version
java.exe -client -Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Djava.library.path=E:\javalib\jogl2\lib -XX:+AggressiveOpts -Xcomp -Xnoclassgc -XX:+UseConcMarkSweepGC -Xms64m -Xmx512m -jar jogamp.jar -RESOLUTION=AUTO -ROUTINE=jogamp.routine.jogl.programmablepipeline.GL3_BasicParticleSystem -FRAMERATE=AUTO -FULLSCREEN=FALSE -VSYNC=TRUE -MULTISAMPLING=FALSE -SAMPLEBUFFERS=4 -ANISOTROPICFILTERING=FALSE -ANISOTROPYLEVEL=16.0 -FRAMESKIP=TRUE -FRAMECAPTURE=FALSE
You will notice that I removed the commands to update the PATH variables. I also added the jar command in to produce jogamp.jar, which will let you recompile the files and then automatically put them in the jar it looks for when it launches.
7) Next, make a textfile in the project root. Add this text to it:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 1.6.0_18 (Sun Microsystems Inc.)
Main-Class: framework.init.Bootstrap
Class-Path: . .\libraries\gluegen-rt.jar .\libraries\jogl.all.jar .\libraries\nativewindow.all.jar .\libraries\jna.jar
8) Change the name of your textfile that you just made to "MANIFEST.MF" (make sure that the .txt extension is visible when you change it, otherwise the filename would be MANIFEST.MF.txt!)
9) In Eclipse, right click on your project folder and select "properties" from the package explorer. Select "Java Build Path" in the navbar, then the "Libraries" tab to the right. You should see the jogl library, expand that and then add "jna.jar" to the list of items, the location of this file will vary depending on your setup.
10) In the eclipse window, in the icon bar on the top there will be three icons, left to right: debug, run, and run external. You will want to click the dropdown arrow next to "Run External" and then select "External Tools Configurations". From there, create a new run configuration under "Program" in the navbar on the right, call it whatever you want. In the "Main" tab (to the left), point the location input box to the .bat file we just modified. Change the working directory to the directory that holds that .bat file. Apply your changes then you should be able to run it if all goes well, using the "Run External" icon.
P.S. To make easy to recompile and run, I would assign a shortcut key to "Run External" (use Window->preferences->general->keys).
Thats it! There is likely a better way to do this using run/debug instead of run external, but this should at least get you up and running :)
(edit:
as Demoscene Passivist pointed out, you can replace steps 6-8 using build.xml with Ant)