Rotation and Lighting Demo

I have posted a new demo which shows off lighting and rotation. The rotation and icosahedron are being defined expressively whereas the lighting and texturing are being defined procedurally with JOGL calls. Hopefully I will fix this soon. The code is currently in my Mercurial repo, and I will be posting an analysis soon.

Jogl and Webstart

My earlier attempt at a Webstart demo failed. I discovered that Netbeans was not linking JOGL as I thought it should in the jnlp file.

This line: <extension name=”jogl” href=”http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp” /> fixed all of my problems.

Without further ado, a weak JavaFX/Jogl demo.

Thanks to PC’s JOGL Blog for this tip.

And finally, animation.

When I started wrapping OpenGL in JavaFX a few weeks ago, my goal was to use the declarative capabilities of the language to easily write 3D scenes and objects and to use the the animation capabilities to interact with the language. The second has proven easier than the first.

First, we set up our timeline with a variable for it to manipulate.

[sourcecode language=”jfx”]
//A dummy variable
var y : Number = 0.0.floatValue();

var timeline : Timeline = Timeline {
repeatCount: Timeline.INDEFINITE
keyFrames :
KeyFrame {
time : 16ms
action : function() : Void {
y += .01.floatValue();
if( y >= 1.0.floatValue() ) { y = 0.0.floatValue();}
}
}
};

[/sourcecode]

Next, we bind it as we would in a plain JavaFX application.

[sourcecode language=”jfx”]
Quad{
color: FXGLColor {
r:1.0.floatValue(),
g:0.0.floatValue(),
b:0.0.floatValue(),
a:1.0.floatValue()
}
verticies : [FXGLVertex{
x:0.2.floatValue(),
y:bind (y+0.2).floatValue(),
z:0.2.floatValue()
},FXGLVertex{
x:0.0.floatValue(),
y:bind (y+0.2).floatValue(),
z:0.2.floatValue()
},FXGLVertex{
x:0.0.floatValue(),
y:bind (y+0.0).floatValue(),
z:0.2.floatValue()
},FXGLVertex{
x:0.2.floatValue(),
y:bind (y+0.0).floatValue(),
z:0.2.floatValue()
}
[/sourcecode]

Finally, we start our timeline.
[sourcecode language=”jfx”]
timeline.start();
[/sourcecode]

Launch

Minor update

My JavaFX-JOGL projects now have a source feed in my “Project Feeds” sidebar. They are hosted from my Mercurial repository. If you want to download them, the project link is .