Java3D Specific Hints

9. Set up your Canvas3D with care

If you work with Tiwi you won't have to worry about this one

To roll your own Java3D initialisation code, you need to get a Canvas3D

If you work with Tiwi you won't have to worry about this one, but if you decide to roll your own Java3D initialisation code take care with the Canvas3D. The crucial step is to make sure you use a GraphicsConfigTemplate3D when you create your GraphicsConfiguration. The wrong way to do things is as follows:

The wrong way to do

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gs.getDefaultConfiguration();
    Canvas3D aCanvas3D = new Canvas3D(gc);

The right way to do

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    GraphicsConfigTemplate3D devconfig = new GraphicsConfigTemplate3D();
    GraphicsConfiguration config = gs.getBestConfiguration(devconfig);
    Canvas3D aCanvas3D = new Canvas3D(config);

Little difference but depending on your graphics card it can mean a big improvement. The desktop machines in the eScience laboratory are particularly sensitive to this one so take note.