"Extending VRML 2 with Java," Vol. 1, Issue 1, p. 42 

2 of 6  

Before diving into an example, consider what makes the EAI different from intra-node Java. The EAI was designed by Silicon Graphics (SGI) for use with their CosmoPlayer VRML 2 plugin viewer. You can read all about the EAI in the Developers’ link at http://vrml.sgi.com. I think of the EAI as a presentation venue for a Java virtual machine. To me, although the EAI requires a .wrl file, the EAI is Java-centric. Intranode Java is VRML 2-centric. So, to the EAI VRML 2 extends Java. To intranode scripting within VRML 2, Java extends VRML 2. This is not a subtle differentiation. These differences affect the whole thought process I follow when I develop Web-based, 3D virtual worlds. 

Consider what is required of your audience when you use the EAI. Each participant in your virtual world must download all the Java classes you use in your world. Yet, the classes they download can include network-aware classes that help them share 3D worlds with others. The classes they download can also include GUI controls created using the Java AWT. Using the EAI, you can provide additional controls beyond those available in their VRML viewer of choice. By focusing on Java, your world can quickly be updated to take advantage of any new Java classes or API made available by Sun or others on the net. 

But I’m sure you do not want to write your whole user interface using Java. Why not take advantage of the existing VRML viewers to give your audience the freedom to move about in your world in a manner they prefer? Using VRML 2 for your 3D presentation delivery is much better than any other available presentation tool on the net today. Yet, a 3D API from Sun shows much promise for the future. Check out http://java.sun.com/products/java-media/ 
   3D/forDevelopers/3Dguide/j3dTOC.doc.html to see Sun’s 3D API specification. 

One final note before I dig into the details of using the EAI. There is no reason you can’t use both the EAI and intranode scripting in the same 3D virtual world. SGI builds the EAI with flexibility in mind. 

Using The EAI 
The process of using the EAI is best understood through example. Simplifying a bit, the overall process goes as follows: 
1. Create the VRML 2 world of your dreams following the syntax of VRML 2. 
2. Add additional empty Transform nodes wherever you might like to add new objects dynamically in response to your audience’s actions. 
3. Uniquely name the nodes you want to change dynamically with Java using the DEF keyword. 
4. Extend Java’s Applet class to create your own class which will be aware of your VRML 2 file. 
5. Create an HTML document to connect your VRML 2 world from step 3 with your class in step 4. 
6. Follow the architecture of the EAI to connect your class from step 4 to the browser object of the Web browser. 
7. Follow the architecture of the EAI to provide attributes in your class in step 4 which map to the DEF nodes of step 3. 
8. Add an additional attribute for each change you want to make to each attribute in step 7 (translation, rotation, scale, color, etc.). 
9. Add an additional attribute for each attribute in step 7 you want to be mouse-click aware. 
10. Create an event handling routine for each attribute you specify in step 9. 
11. Pre-package as text strings any new VRML nodes you may want to place into the world in response to user actions. 
12. Create methods (or additional classes with methods) which use the attributes of your class from step 4 to dynamically change each attribute based on the state of the virtual machine. 

2 of 6  

Copyright 1998 by SYS-CON Publications, Inc. 
VRMLJournal.com