< Zurück | Inhalt | Weiter >

18.6 Renderer

Name: J3D−Renderer−INSTANCE#

A Renderer instance is created for each screen device that is to be rendered into. The Renderer instances are kept in a static Hashtable in the Screen3D class. The Renderer calls into the Canvas3D instances (second JThreadData argument) that are available for rendering. If a device supports swapping, there may be multiple Canvas3Ds in the second argument.

Renderer uses the first argument, which is one of the GraphicsContext3D rendering commands (see table 18.9). The Renderer extracts the messages from the RendererStructure and calls methods on the GraphicsContext3D as appropriate.

The complex Renderer doWork method implements the main Java 3D rendering loop. It sets up the projection matrices, handles stereoscopic rendering, and performs the main rendering loop; specifically, it:

1. Clears the background using the background fill color

2. Calls preRender on the Canvas3D

3. Renders the background geometry

4. Sets the frustrum planes for rendering

5. Renders the opaque geometry

6. Renders the ordered geometry

7. Calls renderField on the Canvas3D

8. Renders the semitransparent geometry

9. Calls postRender on the Canvas3D

10. Performs offscreen rendering


18.6.1 GraphicsContext3D commands
18.6.2 RenderAtoms and RenderMolecule