New Getting Started with JOGL 2 tutorials
mbien // Sep 3, 2010 3:22:38 PMThanks to Justin Stoecker, computer science graduate student at the University of Miami, JOGL gets a new set of getting started tutorials:
JOGL, or Java Bindings for OpenGL, allows Java programs to access the OpenGL API for graphics programming. The graphics code in JOGL programs will look almost identical to that found in C or C++ OpenGL programs, as the API is automatically generated from C header files. This is one of the greatest strengths of JOGL, as it is quite easy to port OpenGL programs written in C or C++ to JOGL; learning JOGL is essentially learning OpenGL[...]
Tutorials:
- index
- Tutorial 1 - Environment Setup
- Tutorial 2 - Creating a Window
- Tutorial 3 - Creating a Render Loop
Another port to JOGL2. This time simple fixed function pipeline...
// Sep 3, 2010 12:59:53 AMAnother port to JOGL2. This time simple fixed function pipeline sphere mapping. Also makes use of some more advanced framework postprocessing functionality. Code can be found here: GL2_SphereMapping.java
JOGL2 routine simulating refraction (and reflection) using GLSL....
// Sep 1, 2010 10:40:46 PMJOGL2 routine simulating refraction (and reflection) using GLSL. Takes fresnels term into account to allow a view dependant blend of reflection/refraction. Code on Github: GL3_Refraction.java. Shader code: .vs .fs
A more complicated JOGL2 port: ?Parallax Occlusion...
// Sep 1, 2010 3:36:46 AMA more complicated JOGL2 port: ?Parallax Occlusion Mapping?. Using multiple texture units for diffuse, specular-, normal- and displacement-map. Also shows quite nice vertex->fragment shader interaction and on-the-fly tangent and bitangent generation (need for the tangent-space-normal map). Java Code: GL3_ParallaxOcclusionMapping.java. Shader code: .vs .fs
Ported my first experiments in GPU based particle systems to...
// Aug 31, 2010 3:35:44 AMPorted my first experiments in GPU based particle systems to JOGL2. The routine consist only of a single vertex shader implementing a simple stateless particle system. Setup and initialization code: GL3_BasicParticleSystem.java. The corresponding vertex shader: .vs
Ported another of my ?old? routines to JOGL2. Simple fixed...
// Aug 30, 2010 3:35:00 AMPorted another of my ?old? routines to JOGL2. Simple fixed functione pipeline routine demonstrating the use of the accumulation buffer to simulation motion blur. Full sourcecode can be found on Github: GL2_AccumulationBuffer.java
Ported another GLSL routine to JOGL2. This time a couple of...
// Aug 29, 2010 3:12:51 PMPorted another GLSL routine to JOGL2. This time a couple of simple lighting vertex shaders implementing flat-, diffuse- and specular-(phong)-lighting with multiple lightsources. Github: GL2_BasicVertexShading.java. The code for the four vertex shaders can be found here: basiclightingshaders/
JOGL2 port of some basic fragment shaders implementing sepia,...
// Aug 28, 2010 3:11:46 PMJOGL2 port of some basic fragment shaders implementing sepia, grayscale, gray-invert and color-invert effect. Code as always on Github: GL2_BasicFragmentShading.java. Corresponding fragment shader code can be found here: rasterizationshaders/
Ported simple uv-unwrapped fixed function pipeline texturing to...
// Aug 27, 2010 3:11:45 PMPorted simple uv-unwrapped fixed function pipeline texturing to JOGL2. Demonstrates Wavefront .obj model loading functionality (exported from Blender) with uv-unwrapped texture coordinates. Full code as always on Github: GL2_UVUnwrap.java.
JOGL 2 - Composeable Pipline
mbien // Aug 25, 2010 6:27:31 AMJOGL provides a feature called 'composeable pipeline' which can be quite useful in some situations. It enables you to put additional delegating layers between your java application and the OpenGL driver. A few usecases could be:
- performance metrics
- logging, debugging or diagnostics
- to ignore specific function calls
public void init(GLAutoDrawable drawable) {
// wrap composeable pipeline in a Debug utility, all OpenGL error codes are automatically
// converted to GLExceptions as soon as they appear
drawable.setGL(new DebugGL3(drawable.getGL().getGL3()));
//..
}
Another predefined layer is TraceGL which intercepts all OpenGL calls and prints them to an output stream.
drawable.setGL(new TraceGL3(drawable.getGL().getGL3(), System.out));
see also GL Profiles
Jogamp wallpaper wrap-up ?
// Aug 24, 2010 8:06:37 AM
Jogamp wallpaper wrap-up ?
Ported one of my ?old? routines to JOGL2. Simple...
// Aug 24, 2010 8:06:27 AMPorted one of my ?old? routines to JOGL2. Simple fixed functione pipeline routine using display lists to increase geometry throughput. Full sourcecode can be found on Github: GL2_DisplayLists.java
Tried out the oldk00l ?Plane Deformation? demo...
// Aug 23, 2010 7:23:45 AMTried out the oldk00l ?Plane Deformation? demo effect using twelve different plane deformation fragment shaders to render a distorted texture to a fullscreen billboard. Fragment shader code is ported from this site to JOGL2. Full Java code can be found on Github: GL3_PlaneDeformation.java. Also take a look at the GLSL fragment shader code: planedeformationshaders/
Pitching my tent: jogamp@conference.jabber.org
// Aug 23, 2010 5:00:00 AM
Pitching my tent: jogamp@conference.jabber.org
Creating a JOGL Eclipse Project
Rami Santina // Aug 22, 2010 10:46:00 AMBelow is a how to create an eclipse project for JOGL project, www.jogamp.org.
Why isnt it on github....well since eclipse takes full paths of the src directories, you would need to practicaly re-do it after fetching the project.
1- After downloading the source code, create an eclipse workspace in the jogl directory ..or anywhere else.
2- Create a new Java project (jogl-eclipse) with jdk_6u21...
3- Now delete the src forder from package explorer which will remove it from the disk as well.
4- Go to Project --> Properties
a- In the Java Build Path menu:
Under Source Tab: Link the following sources "..." is the path to your jogl directory.
.../src/jogl/classes --> jogl
../build/jogl/gensrc/classes --> jogl gensrc
.../src/nativewindow/classes --> nativewindow
.../build/nativewindow/gensrc/classes --> nativewindow gensrc
.../src/newt/classes --> newt
.../build/newt/gensrc --> newt gensrc
.../jogl/src/junit --> junit
In the Libraries tab: add the following as external jars
ant-junit.jar (apache-ant/lib)
gluegen-rt.jar (.../build/jar)
junit.jar (GLUGEN_PATH/make/lib)
b- In the Builders menu:
Add a new Ant Builder: (optional to build from eclipse) with:
Buildfile: .../make/build.xml
Base Directory: .../make
You can then specify the targets if you want. For me I disabled the ant builder and use the command line :). You can also add now the egit plugin...good for visualizing changes (reporting) but kinda of slow and i prefer to commit from shell. You will get some errors in the gensrc code from extra semicolon... should be fixxed in the emmite
And your done!
rigging
Anthony Rogers // Jun 19, 2010 1:29:37 AM
factory particle rain
Anthony Rogers // Jun 16, 2010 8:38:13 AM
interactive web model
Anthony Rogers // Jun 16, 2010 8:36:00 AM
BinaryRing
Anthony Rogers // Jun 9, 2010 9:03:46 PM
oracle
Anthony Rogers // Jun 7, 2010 7:27:37 PM
You have won the Jackpot 3.0
mbien // Jun 3, 2010 2:16:27 PMYou probably remember the project called Jackpot which James Gosling was initially involved with. It was basically a way to migrate client code between incompatible third party libraries by specifying refactoring rules. The project was that good integrated into NetBeans that it looked dead from the outside for a long time, since it was only used internally. NetBeans 6.9 uses Jackpot for most of the in-code hints for instance.
There where various ways to specify the transformation rules, e.g. via a special declarative language or even in Annotations directly in the library-code which would cause incompatibilities (or e.g in conjunction with @Deprecated).
Jan Lahoda recently started with the efforts to make the project usable as standalone tool again. Jackpot 3.0 is available via bitbucket for early adopters.
Back to the Future
I used this opportunity to test jackpotc (the jackpot compiler) with JOGL. What I tired is to provide transformations which transform old JOGL 1.1.1 code into latest JOGL 2 compatible client code. So firstly thanks to Jan for fixing all the bugs we run into while testing the experimental commandline compiler.The first thing I did was to transform the code to properly use OpenGL profiles. As testcode i will use the famous Gears OpenGL demo (but those kind of automatic transformations will only pay of if you use them on large codebases). Since it was written against JOGL 1.1.1 it can only use OpenGL up to version 2.x, which means we can simply use the GL2 profile.
Transformation Rules
'JOGL2 API change: javax.media.opengl.GL -> javax.media.opengl.GL2': javax.media.opengl.GL=>javax.media.opengl.GL2;; 'JOGL2 API change: new javax.media.opengl.GLCapabilities(javax.media.opengl.GLProfile)': new javax.media.opengl.GLCapabilities()=> new javax.media.opengl.GLCapabilities(javax.media.opengl.GLProfile.get(javax.media.opengl.GLProfile.GL2));; 'JOGL2 API change: GL gl = drawable.getGL() -> GL2 gl = drawable.getGL().getGL2()': $d.getGL() :: $d instanceof javax.media.opengl.GLAutoDrawable=> $d.getGL().getGL2();;
Just by looking at the transformation rules you can easily see that it is far more powerfull as any simple text replacement could be. Jackpot uses javac and can therefore work with full qualified names, instanceof and more. It will also correctly fix imports for you (there is currently a open bug in this area). The quotes are used as description string which will be printed when jackpotc runs on every code occurrence which applies.
Invoking Jackpot
jackpotc -sourcepath $SRC -cp $LIBS -d $OUTPUT\
-Ajackpot30_extra_hints=./jogl1Tojogl2.hint $FILESET
$LIBS must contain both library versions, JOGL 1.1.1 and JOGL 2. This is not optimal but it will probably work in most situations to just use both without thinking about an particular ordering or the need to do multiple iterations.
Results
If everything runs fine the console output should look like the sample below for each transformation which applies for the given $FILESET:
./test/oldgears/src/jogl111/gears/Gears.java:54: warning: JOGL2 API change: GL gl = drawable.getGL() -> GL2 gl = drawable.getGL().getGL2()
GL gl = drawable.getGL();
...
The final result is a diff patch located in $OUTPUT/META_INF/upgrade called upgrade.diff containing the complete changeset for the transformation. Now the only thing you have to do is to review the changes and apply them.
@@ -51,7 +51,7 @@
// Use debug pipeline
// drawable.setGL(new DebugGL(drawable.getGL()));
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
...
You can find the complete demo and all ready-to-run shellscripts in the tools/jackpotc folder inside JOGL's git repository. The classic JOGL 2 Gears demo can be found in form of an applet here (uses latest hudson builds... can be unstable).
happy coding!
- - - -
The JOGL repositories are open for contributions. If you would like to add some rules or fix other things... feel free to fork the repos on github and commit to them. (same rule applies for all JogAmp Projects like JOCL, JOAL, GlueGen... etc)
JogAmp at SIGGRAPH 2010
mbien // May 23, 2010 12:17:07 PMThe JogAmp team will be present at SIGGRAPH this year:
3D & Multimedia Across Platforms and Devices Using JOGL Tuesday, 27 July | 4:00 PM - 6:00 PM This session discusses the features, contributions, and future of OpenGL, OpenCL, and OpenMax across devices and OS exposed on top of Java using the JogAmp open-source libraries.link to Session
hope to meet you there.
about JogAmp.
JogAmp is the home of high performance Java libraries for 3D Graphics, Multimedia and Processing. JogAmp consists currently of the projects JOGL, JOCL and JOAL which provide cross platform language bindings to the OpenGL, OpenCL, OpenAL and OpenMAX APIs.
- - - -
(yes i know i should start bogging again :))
JogAmp/JOGL @ SIGGRAPH2010 ..
Sven // May 21, 2010 6:40:27 AMThis year we will be at SIGGRAPH2010 with our own little BOF Session:
3D & Multimedia Across Platforms and Devices Using JOGL
Tuesday, 27 July | 4:00 PM – 6:00 PM | Los Angeles Convention Center Room 507This session discusses the features, contributions, and future of OpenGL, OpenCL, and OpenMax across devices and OS exposed on top of Java using the JogAmp open-source libraries. Sven Gothel sgothel (at) jausoft.com
Until then, we work hard to have at least the following platforms working stable:
- linux-x86_64
- linux-x86
- window-x86_64
- window-x86
- macosx-x86_64
- macosx-x86
utilizing deployment methods
- Applet: applet-loader (fallback)
- Applet: JNLP (where available)
- Webstart: JNLP (where available)
- Pre-Installed JARs (static last-resort (mobile))
where Applet shall work with
- Firefox 3.x
- IE x.y
- Safari z.y
Further more a mobile device running JOGL on top of it shall be done, if time allows
and the ordered beagleboard, an OMAP 3530 device arrives.
Hope to see you there, if you are there
However, all our results will be visible as usual via jogamp.org.
ironman
Anthony Rogers // May 20, 2010 4:43:14 PM
JogAmp.org .. wip ..
Sven // May 7, 2010 2:13:55 AMhttp://jogamp.org is under constructions ..
However, with the great help of Michael Bien, we are close to something here:
- Main http://jogamp.org
- Wiki http://jogamp.org/wiki/
- SCM http://jogamp.org/git/
- Bugzilla http://jogamp.org/bugzilla/
- Our Forum/Mailinglist http://jogamp.762907.n3.nabble.com/
- Gathered News and Blogs http://jogamp.org/blog/
- Gathered Video Streams http://jogamp.org/stream/
- Automated build and test http://jogamp.org/chuck/
- The next JNLP base http://jogamp.org/deployment/webstart-next/
So again .. we are not dead yet
weblands
Anthony Rogers // Mar 15, 2010 7:52:20 PM
interactive web textures
Anthony Rogers // Mar 9, 2010 6:09:46 PM
interactive stage textures
Anthony Rogers // Mar 1, 2010 4:13:53 PM
ticktock
Anthony Rogers // Jan 28, 2010 4:18:18 PM
physics time
Anthony Rogers // Jan 28, 2010 4:08:25 PM