[osg-users] Difference between Viewer+SlaveCamera and CompositeViewer
robert.osfield at gmail.com
Fri Sep 7 02:18:06 PDT 2007
On 9/7/07, Alberto Luaces <aluaces at udc.es> wrote:
> as seen in the "osghud" example, what is the difference between setting a
> Viewer and a slave camera attached to it and creating a CompositeViewer with
> two views? At first sight that two solutions seem almost identical...
The end result is the same, set up is similar - Camera set up is the
same, its just where you attach the camera which is where the
So... with lots of commonality what is the difference - one is that
conceptual - Viewer can have slaves Cameras that are subsubviant to
the Viewer's master Camera, while CompositeViewer instead has a series
of View's each one has its own master Camera. Its worth noting that
Viewer inherits from View, so "is a" View, while CompositeViewer "has
a" list of Views. Now if you think of your hud as an extra View then
conceptually CompositeViewer is a far better fit.
There is also the functional differences - do you want separate event
handling and camera manipulation on your HUD? If so then since these
are manage per View then a CompositeViewer is more appropriate. If
however the HUD is largely passive then a slave camera in Viewer would
be just fine.
Finally there are some differences like ancillary support classes only
handling Viewer right now, for instance StatsHandler is ties to
Viewer. Viewer also handles more sophisticated threading models.
Potentially all of this can be ported over to CompositeViewer, and
this will be done over time, but as of now CompositeViewer is still
the new kid on the block.
More information about the osg-users