At the moment Java does not have any built in support for displaying 3D. In order to use a 3D library such as OpenGL we need a java 'wrapper' which has some native code to call OpenGL. There are a number of possibilities:
- Java3D - This is an 'extension' to Java, which mean that it is not distributed with java and requires a separate download. Java3D is both a OpenGL or Direct3D wrapper and a scenegraph model. Sun have stopped developing this and its future is in doubt, there is a possibility it may become open source?
- JOGL - This is just an OpenGL wrapper, so it is a much smaller download than Java3D. There is a possibility that in future that it may be distributed with Java.
At the moment there are some downsides to the use of Java for 3D.
- Performance - The JVM is an interpreter, and this slows down performance, Just In Time (JIT) compilation instead of interpreting may help if each part of the code is run many times. For large 3D models, there may also be issues with the memory size required, this has to be setup at runtime. Also the vector and matrix library may not make use of the SIMD instructions built into most computers machine code.
- Distribution - Use of Java3d requires a Java2 virtual machine, most PCs don't have this, current browsers still use an older JVM. Therefore to download from the web and then run a java application on most PCs would require: download the program, and download Java 2 and download Java3d. The average user would not be prepared to do this.
Sun seem to be winding down Java3D development, see these links for alternatives.
http://www.javagaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl
http://xith3d.dev.java.net/
http://jogl.dev.java.net/