Title:

Dear all,

I'm using JDK1.3 and Java3D 1.2. I have problem with displaying multiple canvases. In the code below, 2 canvases, i.e. "canvas3D" and "anotherCanvas" are created, and added to the same Frame and the same View object, however only the LAST ADDED canvas will render -- seems that View doesn't traverse ALL the canvases. In this case, the last added canvas is anotherCanvas. If I were to make the first canvas, canvs3D, render, then I have to do "anotherCanvas.stopRenderer(); canvas3d.startRenderer();" How do I actually make ALL THE CANVASES RENDER?

I appreciate any advice, thank you very very much.


        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
       
        GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
        template.setStereo(GraphicsConfigTemplate3D.PREFERRED);
        GraphicsConfiguration bestConfig
            = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
        Canvas3D canvas3D = new Canvas3D(bestConfig);
        Canvas3D anotherCanvas = new Canvas3D(bestConfig);
        add(canvas3D);
        add(anotherCanvas);

        BranchGroup scene = createSceneGraph(args.length>0);

        // SimpleUniverse is a Convenience Utility class
        SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
        View view = simpleU.getViewer().getView();
        view.addCanvas3D(anotherCanvas);
        System.out.println("numCanvas3Ds="+view.numCanvas3Ds()+", isViewRunning()="+view.isViewRunning());

        // This will move the ViewPlatform back a bit so the
        // objects in the scene can be viewed.
        simpleU.getViewingPlatform().setNominalViewingTransform();

        simpleU.addBranchGraph(scene);



Best regards,
Law, Yee Wei
CAMTech, NTU, Singapore
http://www.ntu.edu.sg/camtech
Tel: +65 790 4201

Reply via email to