What would be the best way to render this scene graph in 4 different views/viewports, with each child (attached under the osg::Switch) rendered in its own view? Thanks!
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
On Mon, Sep 26, 2011 at 9:16 AM, Lars Karlsson <klar...@yahoo.com> wrote:
> Hi all, I have a scene graph containing a switch node (osg::Switch) having 4 children.
>
> What would be the best way to render this scene graph in 4 different views/viewports, with each child (attached under the osg::Switch) rendered in its own view? Thanks!
Is it just one subgraph within the whole subgraph that you want to
appear differently on each viewport or do you have four entirely
different subgraphs for each view?
If the former then the best way to handle this is to use a
TraversalMask on the Camera matched to a NodeMask's in the scene
graph, see osgstereoimage example, if the later use a
osgViewer::CompositeViewer see osgcompositeviewer.
Robert.
> > Hi all, I have a scene graph containing a switch node
> (osg::Switch) having 4 children.
> >
> > What would be the best way to render this scene graph
> in 4 different views/viewports, with each child (attached
> under the osg::Switch) rendered in its own view? Thanks!
>
> Is it just one subgraph within the whole subgraph that you
> want to
> appear differently on each viewport or do you have four
> entirely
> different subgraphs for each view?
>
> If the former then the best way to handle this is to use a
> TraversalMask on the Camera matched to a NodeMask's in the
> scene
> graph, see osgstereoimage example, if the later use a
> osgViewer::CompositeViewer see osgcompositeviewer.
>
> Robert.
Yes, I'd like to render one single scenegraph, however four times DIFFERENTLY (i.e. in four different views), and of course simultaneously.
Basically, my first idea was to have one "master" scenegraph, and then somehow replicate this master to four "slave" subgraphs on each frame. However this would quickly become cumbersome, so naturally I thought there should be a better way
I looked quickly into TraversalMask... Is my hunch correct when I say that:
- I make all four subgraphs (under Switch
) active
- I set their masks to 1, 2, 4, and 8 respectively
- I take cameras of each of the four views in CompositeViewer, and set their masks to 1, 2, 4 and 8 respectively
- now the CULL traversals for all four views will cull respective subgraphs:
- CULL for view 1 culls subgraphs 2, 3, and 4
- CULL for view 2 culls subgraphs 1, 3, and 4
- CULL for view 3 culls subgraphs 1, 2, and 4
- CULL for view 4 culls subgraphs 1, 2, and 3
Am I on the right track? Thanks!
On 26/09/11 11:30 , Lars Karlsson wrote:
> Yes, I'd like to render one single scenegraph, however four times DIFFERENTLY (i.e. in
> four different views), and of course simultaneously.
> ...
> I looked quickly into TraversalMask... Is my hunch correct when I say that:>
> - I make all four subgraphs (under Switch) active
>
> - I set their masks to 1, 2, 4, and 8 respectively
>
> - I take cameras of each of the four views in CompositeViewer, and set their masks to 1, 2, 4 and 8 respectively
>
> - now the CULL traversals for all four views will cull respective subgraphs:
>
> - CULL for view 1 culls subgraphs 2, 3, and 4
> - CULL for view 2 culls subgraphs 1, 3, and 4
> - CULL for view 3 culls subgraphs 1, 2, and 4
> - CULL for view 4 culls subgraphs 1, 2, and 3
>
> Am I on the right track? Thanks!
Yes, except instead of a Switch you would probably just use a Group for this, unless you
want to disable/switch the subgraphs as well.
Cheers,
/ulrich
I namely have an arbitrary number N of osg::Switch nodes in my scenegraph, not just four (I simplified the question, so as to make it easier to understand to people).
And in general, I have M views (not just four) into this scenegraph as well. M in general <> N.
So basically, I have a number of switches, and an even greater number K of different paths realizable through these switches.
The point is, each of M views should be capable to display any of these K paths.
Any ideas or pointers as of how to architect this in OSG? Thank you.
--- On Mon, 9/26/11, Ulrich Hertlein <u.her...@sandbox.de> wrote:
Any ideas or pointers as of how to architect this in OSG? Thank you.
Interesting, thank you for the pointer.
Lars
========================
Hi Lars,
On Mon, Sep 26, 2011 at 11:58 AM, Lars Karlsson <klar...@yahoo.com> wrote:
Any ideas or pointers as of how to architect this in OSG? Thank you.
>
I've accomplished the same thing you are trying to do by using cull callbacks on each node. It gives you much more flexibility than node masks.
There are many ways to go about this. I created a custom data structure that stores a unique identifier for each view, and saved this data structure in the user data field of the cull visitor of the view. My cull callback then retrieves this identifier from the cull visitor and determines whether or not to render to the view.
My cull callback maintains a list of all the view identifiers it is either allowed or not allowed to render to. This way you are not limited to 32 bit node masks to control the rendering of nodes.
Hope this information was helpful and let me know if you would like more details.
Cheers,
Farshid
_______________________________________________
However, whenever I double click within the OSGQtWidget (which inherits public osgViewer::Viewer, public AdapterWidget),
it not only generates osgGA::GUIEventAdapter::DOUBLECLICK event but an osgGA::GUIEventAdapter::PUSH event as well.
So whenever I double-click within the OSGQtWidget area, I get the following sequence of events:
osgGA::GUIEventAdapter::PUSH. 760 120
osgGA::GUIEventAdapter::RELEASE osgGA::GUIEventAdapter::DOUBLECLICK: 760 120
osgGA::GUIEventAdapter::RELEASE
This is undesirable because my routine which handles osgGA::GUIEventAdapter::RELEASE event
is ALWAYS executed before my osgGA::GUIEventAdapter::DOUBLECLICK routine.
Is there a way for OSGQtWidget to recognize just the double-click, i.e. generate just the
osgGA::GUIEventAdapter::DOUBLECLICK event? Thanks!