Hi, i am trying to apply multi camera on my project. I am referencing "Examples osgcamera". Here i did almost the same with your examples but there are few changes. Maybe this changes causes problems because in your examples runs in 60fps even there are 6 windows. My fps is 60fps/numberOfWindows :( so i want to ask some questions about this.
Here is my code about multi window: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void MyApplication::multipleWindowMultipleCameras() { const int numberOfWindows = 4; osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); unsigned int screenWidth, screenHeight; wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), screenWidth, screenHeight); double aspectRatioScale = (double)numberOfWindows / 2; double translate_x = double(numberOfWindows) - 1; simBase::SimCamera* camera; //SimCamera encapsulates osgCamera. for (int i = 0; i < numberOfWindows ; i++, translate_x -= 2.0) { if (i == 0) { camera = getCamera(); //myApplication main camera. } else { camera = new simBase::SimCamera(); //new camera which shows other parts of scene. } osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; traits->screenNum = 0; traits->x = (i * screenWidth) / numberOfWindows; traits->y = 0; traits->width = screenWidth/numberOfWindows - 1; traits->height = screenHeight; traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::Camera* osgCamera = camera->getOSGCamera(); osgCamera->setGraphicsContext(gc.get()); osgCamera->setViewport(new osg::Viewport(0,0, screenWidth / numberOfWindows, screenHeight)); GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT; osgCamera->setDrawBuffer(buffer); osgCamera->setReadBuffer(buffer); simBase::SimView* view = getView(); //SimView encapsulates osgViewer::View. if (i != 0) //if i apply this process to main camera, then i see nothing on the scene. So i disabled this for first camera. view->addSlave(camera, osg::Matrix::scale(aspectRatioScale, 1.0, 1.0)*osg::Matrix::translate(translate_x, 0.0, 0.0), osg::Matrix() ); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// One important distance here is: i use "osgViewer::View" directly. I dont use "osgViewer::Viewer". and MyApplication has a "osgViewer::CompositeViewer". Even if i call the function as getCompositeViewer()->getView(0)->addSlave(osgCamera, osg::Matrix::scale(aspectRatioScale, 1.0, 1.0)*osg::Matrix::translate(translate_x, 0.0, 0.0), osg::Matrix() ); So i wonder, is it really that much different to use CompositeViewer or Viewer. Our design looks like a bit Delta3D (maybe you know) so i wanted to get some advices about this.. I wanted to know if Viewer has capability show multiscreen better than CompositeViewer or something else... -- Ufuk
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org