Hi Carsten,

thanks for your help, it pointed me in the right direction. I got it now
running, beside the initOSG() method I posted last time I had to change
the paintGL() method of the QGLWidget based widget as well. Below are
the changed methods:

---

void MainWindow::initOSG( int argc, char **argv )
{
    bool clustermode = true;

    OSG::osgInit(argc, argv);

    ConfigManagerP configManager =  ConfigManager::the();
    SceneManagerP sceneManager = SceneManager::the();
    OSG::MultiDisplayWindowMTRecPtr multiWindow;
    OSG::PassiveWindowMTRecPtr passiveWindow;

    sceneManager->renderWidget = ui.renderWidget;
    sceneManager->sceneTreeWidget = ui.treeWidgetScenegraph;

    passiveWindow = OSG::PassiveWindow::create();
    ui.renderWidget->passiveWin = passiveWindow;

    sceneManager->setWindow( passiveWindow );

    if ( clustermode )
    {
        // clear changelist from prototypes
        OSG::Thread::getCurrentChangeList()->clear();

        multiWindow = OSG::MultiDisplayWindow::create();
        ui.renderWidget->clusterWin = multiWindow;

        multiWindow->editMFServers()->push_back( "192.168.0.101" );
        multiWindow->editMFServers()->push_back( "192.168.0.102" );


        multiWindow->setManageClientViewports( false );
        multiWindow->setClientWindow( passiveWindow );       

    }

    OSG::NodeMTRecPtr modelRoot = ModelManager::the()->getModelRoot();
    sceneManager->setRoot( modelRoot );
    sceneManager->showAll();
   
    if ( clustermode )
    {
        OSG::ViewportMTRecPtr clusterVp = OSG::Viewport::create();
        OSG::ViewportMTRecPtr clientVp = passiveWindow->getPort( 0 );
        clusterVp->setCamera( clientVp->getCamera() );
        clusterVp->setBackground( clientVp->getBackground() );
        clusterVp->setRoot( clientVp->getRoot() );
        multiWindow->addPort( clusterVp );

        multiWindow->init();
    }

    OSG::commitChanges();       
}

---

void OpenSGWidget::paintGL()
{
    if ( clusterWin )
    {
        sceneManager->getNavigator()->updateCameraTransformation();
        clusterWin->render( sceneManager->getRenderAction() );

        OSG::Thread::getCurrentChangeList()->clear();
    }
    else
    {
        sceneManager->idle();
        sceneManager->redraw();
    }

    swapBuffers();
}

--

Cheers,
Christoph

------------------------------------------------------------------------------

_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to