I am trying to use an osg::Switch node in my scene to toggle on/off certain sub-graphs.
the way I have my subgraph set up is:
I have a geode (textGeode) which is placed under a switch node and the switch is then place below an LOD node.
Code:
annotationsSwitch->addChild(textGeode, true);
annotationsLod->addChild(annotationsSwitch, 0, 700);
When I try using the following to turn the switch On/Off, my geometry is still visible.
Code:
setChildValue(
getSearchedNode(QString("textGeode")), false);
OR
Code:
setAllChildrenOff ()
I was under the impression that turning the geode off would ensure that the geometry placed below the geode would also be off.
Do I need to use node masks to achieve this?
Thanks!
Sincerely,
Sanat.
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=42845#42845
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
I suspect that your code to find the switch node is not working.
As a quick and dirty example try saving a pointer to the switch node as a global and in your main loop try turning it on and off.
Code:
int n = 0
while( !viewer.done() )
{
annotationsSwitch->setValue(0, (++n) % 2 );
viewer.frame();
}
Assuming you only have the one child your text should flash on/off.
That would help you narrow down if the problem is with setting the switch value or if the problem is in getSearchedNode.
Cheers!
Eric
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=42847#42847
The problem was that I had more than a single switch node and only one attribute was getting turned on/off which I only noticed after zooming into my scene.
I corrected it by writing a visitor accumulating all the switches and turning each of them on/off.
Thanks,
Sanat
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=42888#42888