Tuesday, August 28, 2007

Using Java for CS575

LWJGL or JOGL? Eclipse or Netbeans?

In a nutshell:
LWJGL - It handles (has api for) input and sound. It draws to its own Display class, not to Swing/AWT/SWT (or at least not easily... as far as I know). It was around before JOGL.
JOGL - It has Swing/AWT/SWT integration (for better or worse). It only does OpenGL, sound and input must be handled by other libraries.
Eclipse - I have used it for several years for java and webapp development. A rock solid, fantastic IDE.
Netbeans - version 6 promises to be the best thing since sliced bread. I have been playing with it due to the hype. Its GUI designer is top-notch (if you are into that sort of thing). I'm not certain how I feel about its build system in comparison to Eclipse's.

I'm not new to Java, but I am new to OpenGL. I did some googling to see whether LWJGL or JOGL was the way to go. I was leaning towards JOGL with Eclipse until I saw this: https://netbeans-opengl-pack.dev.java.net/

Here's what it buys me:
  1. It Can create a "Simple OpenGL" project in netbeans.
  2. The project is instrumented with all dependencies: JOGL's jar and OpenGL bindings for the various operating systems (windows, linux, solaris, os x).
  3. The build system produces distributables for all the aforementioned operating systems in just one click. You don't have to fiddle with Ant, Maven, or Eclipse packaging plugins.
  4. It has code demo/samples galore.

Setting it up was not as straight forward as I would have liked. Normally, you add a plug-in to Netbeans and away you go. But there are 2 mitigating factors. The first is that Netbeans 6 is still under development. The latest milestone release is 6.0m10. The second is that the OpenGL pack does not work with 6.0m10 and prior (see the note at the bottom of their home page).

So what you have to do is get the nightly build of Netbeans, install it, and then you may add the plugin(s). In the case of the OpenGL Pack, there is an extra step in that you must also install its "update center".

Netbeans 6.0 nightly version + OpenGL Pack:
Brief instructions and the "update center" file are provided from links on their home page. The following instructions are based on my installation of the Netbeans nightly build.

1. If you haven't installed a java JDK, do it now. I would suggest version 1.5+.

2. Download the OpenGL Pack's "update center" file from their site. Remember where you save it!

3. Get the latest nightly build of netbeans and install it. Be sure to select the appropriate "Platform".





4. Launch it. When it is up, f choose Tools->Plugins. When the plugins dialog is open choose the "Downloaded" Tab and click the "Add Plugin" button:


5. Locate the file that you downloaded earlier:

6. Install the Update center:


7. Click the "Available" Tab and locate the OpenGL plugins and choose and install them:


After the installation, you will be asked to restart the IDE. Do so. When the ide has been restarted you can create a new JOGL app:



But that's not all, there are some demos that come with it including demos from the redbook:



Ok, that should get you started on the road to Java and JOGL.