Tutorials,Tips and Tricks

In order to build a true Java platform, Sun realized early on that it needed to fill out the API picture beyond the limited functionality available in the Java 1.0 core platform. Sun has grown the core a great deal with the 1.1 and impending 1.2 releases, but there are still some pieces missing from the Java puzzle.

Sun and its partners developed the Java Media and Communication APIs to provide the missing multimedia programming pieces. Two of the biggest pieces, 2D and 3D graphics, are targeted with the Java 2D and 3D APIs, respectively. Java 2D is a core platform API beginning with Java 1.2, while Java 3D will be released as an Extension API shortly after the 1.2 platform becomes available. We have recently finished a series of columns on Java 2D; now we turn our attention to Java 3D.

Java 3D is meant to give Java developers the ability to write applets and applications that provide three dimensional, interactive content to users. Sun has some heavy competition from other 3D graphics technologies in this arena, and Java 3D has an uphill battle ahead of it if it's to defeat the incumbent graphics standard, OpenGL.
A request for reader comments on 3D graphics APIs for Java indicated serious interest in Java 3D and Java OpenGL bindings, so I've decided to concentrate my efforts on these technologies in the coming months.
A more limited amount of interest was expressed in VRML. Consequently, I am going to deal with VRML by demonstrating its use in Java 3D with VRML97 content loaders and Sun's Java 3D VRML97 browser. Direct3D received very little interest, so I've decided not to pursue this path, except to mention where one of the other technologies may support or interoperate with it.

Pros and cons of Java 3D

This month we begin our tour of 3D graphics APIs for Java by exploring Java 3D. We'll start by discussing some of the API's major strengths and weaknesses. 3D graphics can seem at times rather obtuse and, thus, can be difficult to explain. If you have any lingering confusion about my examples or explanations, please feel free to write me with your questions or comments, and I'll do my best to address them.
Selling points for Java 3D:
  • It provides a high-level, object-oriented view of 3D graphics. Java 3D accomplishes this in part by using a scene graph-based 3D graphics model. (We'll discuss this concept in more detail later in the article.) This approach is intended to help programmers without much graphics or multimedia programming experience use 3D in their applications. In stark contrast to lower-level, procedural 3D APIs like OpenGL, which are designed to optimize for the best possible speed and give programmers the greatest possible control over the rendering process, Java 3D is meant to be straightforward enough for any experienced Java programmer to learn.
  • If you don't need low-level access to rendering operations, Java 3D may be an option. Rendering access is limited to requests via attributes and capability bits, similar in form and function to Java 2D's rendering hints. (See Resources for links to my previous series on Java 2D, which included discussion and examples of 2D's rendering hints).
  • Java 3D is optimized for speed where possible. The runtime uses rendering capability bits, in fact, to optimize the scene graph for the fastest possible renders. This approach makes Java 3D more applicable to interactive graphics environments (games, simulations, low-latency situations) than to offline, high-quality graphics applications (like render farms).
  • A large and growing number of 3D loaders are available to import content into the Java 3D runtime. Sun has made a Java 3D VRML97 file loader and browser freely available with code. Look for next month's Media Programming column to explore Java 3D loaders in more detail.
  • Java 3D requires vector math capabilities not available elsewhere in the Java platform. These math operations are currently located in the javax.vecmath package and may be moved into the core platform in the future.
  • Java 3D supports a number of exotic devices (wands, data gloves, and headsets, for example). Thecom.sun.j3d.utils.trackers package included with Sun's implementation provides classes for Fakespace, Logitech, and Polhemus devices. These devices are not widely used, however, so I will not discuss them in great detail.

Category ,

0 Responses so far.

Post a Comment

Total Pageviews