Michael Bien's Particle System - get it up and running

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Michael Bien's Particle System - get it up and running

gavanw
This post was updated on .
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-particle

And, as linked to you can get the full source here (with other useful examples):
http://github.com/demoscenepassivist/SocialCoding/tree/master/code_demos_jogamp

Since 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_jogamp
and 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)
Reply | Threaded
Open this post in threaded view
|

Re: Michael Bien's Particle System - get it up and running

Demoscene Passivist
Administrator
Cool, nice guide on how to get the demos up and running in Eclipse. There are a few things I might add to ur tutorial:

1. If u are under Windows, and just want to have a quick look what these demos really are and if JOGL works on ur installation u can simply download a precompiled version from github under build_demos_jogamp/. Just copy a up2date JRE in the runtime folder and u are good to go.

2. Theres an Ant build.xml in the build/ folder wich more or less does steps 6-8 of your guide automatically. You can use it to deploy a full "release ready" version of the demos to some folder of your choice with a single click.

3. The reason why theres a runtime folder wich is supposed to contain the JRE, is ease of deployment in conjunction with the above mentioned Ant build script. I totally agree with u that repackaging the JRE with ur application is really "bad style" but as I'm quite lazy and redeploy often I preferred the all-in-one-folder method this time .

Other than the above mentioned I can only add: Keep up the good work!

greets,
Demoscene Passivist

ps. As a sidenote: The tumblr blog and the repository ur referred to aren't maintained by Michael but rather by me. Yes, sometimes I wish I were Michael Bien, but most of the time I'm quite comfortable with being myself .
Reply | Threaded
Open this post in threaded view
|

Re: Michael Bien's Particle System - get it up and running

gavanw
Oh, I thought that "DemoScene Passivist" was just an alias that Mike used, shows how little I know

Also, I am very inexperienced with Eclipse (and Ant, for that matter), I have only used it a little bit for C++ with CDT, so yes, to everybody I would highly recommend using the build.xml with Ant instead.

P.S. I can respect laziness, especially if it helps your solution run "out of the box" more easily. :)
Reply | Threaded
Open this post in threaded view
|

Re: Michael Bien's Particle System - get it up and running

Demoscene Passivist
Administrator
I've posted a link to this thread/ur guide on my blog and also on twitter. I guess other people who stumble upon the blog and don't directly know about jogamp.org and this forum will find ur guide really usefull too.
Reply | Threaded
Open this post in threaded view
|

Re: Michael Bien's Particle System - get it up and running

Demoscene Passivist
Administrator
Just a small update/sidenote: As I have recently integrated background music and music-synchronization support to my framework u have to change the classpath to incorporate the new libraries under step 7):

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 .\libraries\newt.all.jar .\libraries\jl1.0.1.jar .\libraries\mp3spi1.9.4.jar .\libraries\tritonus_share.jar .\libraries\jogg-0.0.7.jar .\libraries\jorbis-0.0.15.jar .\libraries\vorbisspi1.0.3.jar

Other than that everything should be the same as described by Gavanw.