Robert Osfield wrote:
Hi Peter, Benoit et,
On Mon, Mar 16, 2009 at 8:15 PM, Peter Amstutz
<peter.amst...@tseboston.com <mailto:peter.amst...@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.
Well, I force it to use single threading since my render thread already
runs independently of the main logic thread. This avoids most of the
problems you mention, but in general I wouldn't recommend this solution
either. I just thought I'd throw it out there because it has worked for
me so far. I think I am doing it this way because I originally wrote my
code for OSG 1.2, which didn't have any of the nice osgViewer
infrastructure.
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.
I'll take a look at this. The (doxygen) documentation is a bit thin
here, so I wasn't sure what exactly CompositeViewer was for -- I assumed
it was for rendering multiple subwindows of a single main window.
I'm still fuzzy on the relationship between Graphics Context, View,
Viewer, Camera, Scene -- there's at least a couple layers of abstraction
there. Especially when I see inheritance graphs like this
(http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a01055.html)
:-)
- Peter
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org