In the last chapter, a brief introduction on the creation of 3D content through the use of Java 3D and other programming methodologies for virtual reality applications has been Given .Before giving details on the various Java 3D classes and functions in subsequent s, we will now discuss the basic Java 3D program structure in this . Specifically, JDK installation, programming and compiling tools, as well as the difference between Java 3D applet and application will be explained. Originated from Sun Microsystems, the Java 3D API is made up of a few packages (Java platform API specification, 2006), which in turn contain the classes of some related components and elements. Specifically, the package javax.media.j3d (Package javax.media.j3d, 2006) contains the most basic classes, often referred to as core classes, which are needed to create a Java3D program. Note, however, that a complete application will often use many other packages and classes as well. As an example, if there is a need to use vectors, points and matrices to draw the virtual universe, the package javax.vecmath (Package javax.media.j3d, 2006) has to be imported. Another important package is java.awt (AWT stands for Abstract Windowing Toolkit), which include classes to create a window to display the rendering. Associated with each class is a variety of methods to aid the programmer in creating the application. Together, these classes and methods give the programmer the basic tools to construct a simple rotating cube system to a 3D virtual city. An important concept in Java 3D programming is that the program and the programming objects created has a tree like structure. Thus, a Java3D program will create and instantiate Java 3D objects and places them in a virtual world through the use of a tree like scene graph. This will be explained in greater detail in subsequent sections
To develop an application in Java3D, several tools for writing, compiling, running, and debugging Java3D programs are needed. Appendix A gives details on the various steps needed for downloading three major tools, the Java Development Kit (JDK), the JCreator Integrated Development Environment and the Java3D Application Programming Interface (API), for this purpose. Note that the steps described are for workstations that have not had any Java applications or programs installed in the system. For PCs with Java programming tools already installed, only step three will need to be carried out.
The JDK bundle comprises some programming tools and the Java Runtime Environment (JRE). The latter consists of the Java Virtual Machine and class libraries that will be used in a production environment. The programming tools include the following primary components:
Javac, for converting a Java source code to a Java bytecode.
Jar, for archiving related class libraries into a single JAR file.
Javadoc, for generating documentation from source code comments.
Jdb, the debugger.
A number of sample programs are also included in the JDK bundle.
The JCreator IDE serves to aid programmer in developing and running programs. It consists of a source code editor, a compiler, some build automation tools and a debugger. The JCreator IDE is for programming in Java (and Java3D) and will enable compiling, debugging and the running of Java programs using the appropriate menu options.
Perhaps most importantly, the Java3D API provides the tools needed for programming in Java3D and running 3D-programs. This API is basically an extension of the JDK bundle, and the downloaded files will simply be added to the appropriate .bin and .lib folders in the JRE that was created when the JDK bundle was installed onto the system.
Lastly, all these software are freely available from http://java.sun.com/.Top
A Simple Java3d Programjava 3D Program For A Rotatingcube
To illustrate the main principles and components needed for creating a Java3D application, Figure 1 shows a simple program for creating a rotating color cube.