[ Contact ] [ Links ] [ Previous : 11 / 20 : 8. Go native ... but only if you have a really good reason ] [ Up ] [ Next : 13 / 20 : 10. Play by Java3D´s rules ]

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.

 

 


See the "Links" link above to find out the sources of the proposed informations
Pascal Vuylsteker / eScience / Computer Science / ANU
Last modified: 20/4/2004
TOC - Print
Send your comments at :
<Hugh.Fisher@anu.edu.au>