Hi Fan, For HUD's like this have a look at the osghud example. The key bit you need to add is to set the ClearMask to just clear the depth buffer of the overlaid Camera, and set the RenderOrder of the Camera's to make sure the overlay camera gets drawn second.
Robert. On 24 April 2013 16:57, Fan ZHANG <[email protected]> wrote: > Hi all, > > Sorry to disturb but I want to know how can I overlap two cameras with two > different scenes? > > Here the picture is the result I tried with CompositeViewer, but this is > not exactly what I want. As you can see, the names of houses are displayed > in one view while buildings in another view. > > I have one scenegraph containing only buildings and another one containing > only house names. Due to some specific needs, I can not put them under the > same camera. > > So I have one camera adding houses as children and meanwhile one camera > adding house names as children. So how can I overlap them in one view? > > I tried like this but failed, I don't have a good master of OSG theory > part :( > > > Code: > > osgViewer::Viewer viewer; > //is this a right way to add houses to one camera? > viewer.getCamera()->addChild(houses); > > //here I want to construct a camera, with all the parameters the same as > the viewer.getCamera(), so that they can be overlaped. Is this a right way? > osg::Camera* myCam = new osg::Camera; > myCam->setProjectionMatrix(viewer.getCamera()->getProjectionMatrix()); > myCam->setViewMatrix(viewer.getCamera()->getViewMatrix()); > myCam->setViewport(viewer.getCamera()->getViewport()); > myCam->addChild(house names); > myCam->setReferenceFrame(osg::Transform::ABSOLUTE_RF); > viewer.addSlave(myCam, false); > > > > And I don't know how to make them visualized. > > I searched for answer in older posts, and I found the "Producer" example, > I don't have the Producer version. Then there was suggestion of looking at > osgdistortion example where there are multiple cameras. However these > multiple cameras share the same scene dataset, simple by > viewer.assignSceneDataToCameras(). But I don't use the same dataset. > > I don't know if I make myself clear here. > > So huge thanks in advance for any reply:) > > Fan > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=53788#53788 > > > > > Attachments: > http://forum.openscenegraph.org//files/result_155.png > http://forum.openscenegraph.org//files/result_212.png > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

