HI Gianni,

On 18 October 2013 11:50, Gianni Ambrosio <[email protected]> wrote:

> If I undarstand correctly, then I have to create a composite viewer with a
> proper view for a 2D track even if the user may not need it (i.e. 2D track
> object not loaded). That would not be a real problem.
> But  on the other hand a user can load more then one 2D track object (even
> if in this case it would not have really sense). Of course a new view can
> be added for each 2D track object but that means my scene manager should
> depend on the viewer (at the moment this dependency is not needed).
>

I would certainly code the application so the adding/removing of the 2D
tracks would be done at a high level that knows about the CompositeVewer
and can add/remove/recyle the required View.

If you wanted the add code to not know about the viewer then I guess you
could use a singleton method for accessing the current viewer, or pass the
viewer pointer to add methods.

Another alternative would be to not use CompositeViewer but instead place
the osg::Camera for each 2D track into the main scene graph.  The osghud
example shows how to do this with an in scene graph osg::Camera as well as
the more conventional and recommend routes of placing the HUD as a slave
Camera or separate View.

The advantage of the CompositeViewer with separate Views is each View can
have it's won event handles and camera manipulator, so allows for unique
behaviours in convenient form. Conceptually it also easy to get your head
around.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to