Hi everyone:
 
I wrote a j3d program included a mouse rotate behavior and one Canvas3D.
It was working very correctly , but when I added a off-screen Canvas3D to my program, the behavior didn't work any more.
Why is it ? I listed part of code below here:
 
Thank in advance
 
Greg
---------------------------------------------
protected Canvas3D[] createCanvas3D( GraphicsConfiguration gconfig )
    {
        Canvas3D[] canvases = new Canvas3D[2];
        canvases[0] = new Canvas3D( gconfig );
        canvases[1] = new LISOffCanvas3D( gconfig, true );
        if( canvases[0] == null ||  canvases[1] == null ) {
            System.err.println( "Can't initialize a canvas" );
            System.exit( 0 );
        }
        canvases[0].setSize( getCanvas3dWidth( ), getCanvas3dHeight( ) );
      
        Screen3D sOn = canvases[0].getScreen3D();
        Screen3D sOff = canvases[1].getScreen3D();
        Dimension dim = sOn.getSize();
        sOff.setSize( dim );
        sOff.setPhysicalScreenWidth( sOn.getPhysicalScreenWidth() );
        sOff.setPhysicalScreenHeight( sOn.getPhysicalScreenHeight() );
 
        return canvases;
    }
 
protected VirtualUniverse createVirtualUniverse( Canvas3D[] canvases )
    {
        m_Viewer = new HomoPanoViewer( m_StatusPanel, canvases[0] );
        LISVirtualUniverse lvu = new LISVirtualUniverse( m_Viewer );
        //if I added code below, the mouse behavior wouldn't work any more
        m_Viewer.getView().addCanvas3D( canvases[1] );
        return lvu;
    }

Reply via email to