What you have looks basically right, except I don't understand why you have:
ref_ptr<Group> group = new Group;
switchnode->addChild(group.get());
That seems unnecessary to the task at hand.
How are you determining that you are getting the wrong results? What you
show as the result seems impossible for the code you've posted, as 'parent'
only adds one child: the switch.
Inserting a node above another node is a common task and one that is
somewhat error-prone to implement. I've often wondered if it would make
sense to have Node methods for insertAbove() and insertBelow(). This was a
feature in PEI VisKit and we made frequent use of it at my old employer.
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org