Hi Ulrich,

Thank you again for your patience and insight.
Your code makes absolute sense. But I still get the same result. If I have no 
trackball manipulator for either view, I get a black screen. When I have set it 
up for one view, only that view gets an image. My code:

Code:

        osg::Group* scene = new osg::Group();
        osg::Node* groundNode = NULL;
        osg::Node* tankNode = NULL;
        groundNode = osgDB::readNodeFile("cow.osg");

        scene->addChild(groundNode);
        osgGA::TrackballManipulator* Tman = new osgGA::TrackballManipulator;
    
        // construct the viewer.
    osgViewer::CompositeViewer viewer(arguments);

                        
    if (arguments.read("-2"))
    {

        // view one
        {
        
                        osg::Camera* camera = new osg::Camera;
            osgViewer::View* view = new osgViewer::View;
            view->setName("View one");
            viewer.addView(view);

            view->setUpViewOnSingleScreen(0);
            view->setSceneData(scene);

// Get the scene bounding sphere
                        osg::BoundingSphere bsph = scene->getBound();

// Look at the center of the scene
osg::Vec3 lookAt = bsph.center();

// Place eye at an appropriate distance 'south' of the look-at point
osg::Vec3 eyef = lookAt + osg::Vec3(0,-1,0) * bsph.radius() * 3.5f;

// Set camera view matrix
camera->setViewMatrixAsLookAt(eyef, lookAt, osg::Vec3(0,0,1)); 
view->setCamera(camera);
        }

        // view two
        {
                        osg::Camera* camera = new osg::Camera;
            osgViewer::View* view = new osgViewer::View;
            view->setName("View two");
            viewer.addView(view);

            view->setUpViewOnSingleScreen(1);
            view->setSceneData(scene);

// Get the scene bounding sphere
                        osg::BoundingSphere bsph = scene->getBound();

// Look at the center of the scene
osg::Vec3 lookAt = bsph.center();

// Place eye at an appropriate distance 'south' of the look-at point
osg::Vec3 eyef = lookAt + osg::Vec3(0,-1,0) * bsph.radius() * 1.5f;

// Set camera view matrix
camera->setViewMatrixAsLookAt(eyef, lookAt, osg::Vec3(0,0,1)); 
view->setCamera(camera);
//view->setCameraManipulator(Tman);
        }
    }

        viewer.realize();


        while(!viewer.done())
        {               

                viewer.frame();
        }




I must be missing something obvious I guess, but for me it isn't obvious (yet). 

Thank you!

Cheers,
Bart Jan

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34900#34900





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to