Java 3D



Java 3D allows Java and applets to make use of OpenGL 3D graphics. It was one of the simplest parts of this project to set up. First of all, I downloaded the JDK 1.4 (java Development Kit) from java.sun.com. Next I began the installation of Java 3D itself:

  • Read about Java3D at Sun's Java3D page - there are multiple versions available including Linux and Windows.
  • Download Java 3D from ftp://ftp.uk.linux.org/pub/linux/java/java3d.
  • For installation in Linux:
    • Move the downloaded file to the /usr/java/j2sdk1.4.0 directory (mv java3d-sdk-1.3-beta1-linux-i386.bin /usr/java/j2sdk1.4.0)
    • Make it executable (chmod u+x java3d*)
    • Run it (./java3d-sdk-1.3-beta1-linux-i386.bin)
  • Finally, Agree to the license and let the installation finish.
After installing, I went to the demos/java3d directory and played about with the demo programs to see what it could do. I noticed that if I ran some of them as applets, X sometimes crashed when the appletviewer closed. Running it as a stand-alone application, or inside Konqueror, didn't show this problem.

I decided it would be a good idea to learn OpenGL programming using Java3D. I bought the book "Java 3D Jump Start" which was written by Aaron E Walsh and Doug Gehringer and produced by Sun Microsystems Press. I've been working through examples shown in the book, along with some examples from websites, from a simple Hello Universe application to a slightly more complex one using directional lighting and textures. I've managed to produce a simple application that remotely resembles what I want to do for my project. The image below shows a screenshot of it - displaying 3 spheres joined with a line. Click here for the source code.

Update: 20020224 4:24 pm
I've now got all the 3D objects from the previous example in a Group (javax.media.j3d.Group). The group can be rotaded and moved by the mouse. This is getting much closer to what I'm looking for. Source code is available here.

Incidentally, I can't get Java 3D to install at al on Windows XP (screenshot). If anyone can help with that can you let me know please?

[continue>>]