[osg-users] switch between two camera

Robert Osfield robert.osfield at gmail.com
Mon Mar 16 13:52:49 PDT 2009


Hi Peter, Benoit et,

On Mon, Mar 16, 2009 at 8:15 PM, Peter Amstutz
<peter.amstutz at tseboston.com>wrote:

> 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.


I'm afraid I really wouldn't recommend this solution, having multiple
viewers just to alternate between views is complicated implementation and
conceptual wise and you'd be very lucky for it to work in anything other
that very limited usage models.  Using multiple viewers will cause problems
with threading, timing codes, it'd be a right old mess.


> 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.


In your case you are talking about multiple Views, and this is fine, but you
don't use multiple Viewers for it, you'd use a single CompositeViewer with
multiple Views.  You can add and remove Views, or just toggle Camera's
on/off using NodeMask's.

For Benoit having a single master Camera track different CameraView nodes in
the scene might well be the most convinient way to manage things.

Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090316/d27aa2f7/attachment-0003.htm>


More information about the osg-users mailing list