JavaFX + Netbeans + JOGL

I am wanting to make several games. One of these is a 3D game with you can find some of the plot for on my main wiki. I have decided to see what will happen if I were to try and use JavaFX for some rapid UI prototyping and to get some simple 3D effects running.

First, JavaFX is going through rapid and turbulent development. I have chosen to use the compiled JavaFX from the OpenJFX project.

Next, JavaFX doesn’t really have integration points for 3D yet. However, I was able to get the GLCanvas element embedded in a frame.

[sourcecode language=’java’]
/*
* Main.fx
*
* Created on Jul 23, 2008, 6:14:43 PM
*/
package test3d;
/**
* @author summers
*/
import javax.media.opengl.*;
import javafx.ui.Frame;
import javafx.ui.Panel;
import javafx.ui.Canvas;
import javafx.ui.canvas.Text;
// place your code here
java.lang.System.out.println(java.lang.System.getProperty(“java.library.path”));
var win:Frame = Frame {
title:”Hello World”,
visible:true,
onClose: function() {java.lang.System.exit(0);},
width:100;
height:100;
}
win.getWindow().add(new GLCanvas());
[/sourcecode]

The the magic occurs in the last line. The window of a JavaFX frame is an awt Window. By adding the canvas here, I should be in all awt and should have the high performance hardware accelerated 3D. I do not know if this is true yet but I will keep you all posted.

In netbeans I eventually had to manually copy the so libraries into the dist/lib directory of the project before I could get it to run as well.