[osg-users] switch between two camera

Peter Amstutz peter.amstutz at tseboston.com
Mon Mar 16 13:15:07 PDT 2009


The way I handled this in my application was to create multiple 
instances of osgViewer::Viewer with a separate camera for each view but 
all bound to the same output window.  On each render iteration, draw 
just the active camera.

The best solution depends on exactly what you need to display; I decided 
to switch between completely independent scenes because my 2D and 3D 
views looks actually render somewhat different geometry (the 2D ortho 
view is an abstracted version of the "real" 3D geometry).  Having 
entirely separate scenes is also pretty straightforward although it 
imposes some overhead due to duplication of resources that could 
otherwise be shared between among views.

If having multiple osgViewer::Viewer objects isn't desirable, you could 
also look at osgSim::MultiSwitch (depends heavily on the organization of 
your scene graph) or use node masks (osg::Node::setNodeMask() and 
osg::Camera::setCullMask()) to get fine grained control over which parts 
of the scene to render for a given frame.

- Peter

Ben wrote:
> thank's, but I don't see how to use osg::CameraViews, does somebody have a little example??
>
> I will  try to specify more what I want to do.
> I have one scene to render with 2 differents views, one as a FPS 3D vue, and one as "2D vue" (the camera is on top with an orthografic vue).
> Each camera has its own manipulator.
>
> only one vue is displayed at once. I thought to make something like schema below, but I don't know how to made it with osg.
> [Image: http://nsa06.casimages.com/img/2009/03/13/09031302561860352.jpg ] (http://www.casimages.com)
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=8446#8446
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>   




More information about the osg-users mailing list