Hi Jesper, Adding/removing node/drawables/stateset from the scene graph is not something I would recommend users do for toggling the visibility of items. The best way is to decorate the subraphs with an osg::Switch node, or use the osg::Node::set/getNodeMask(uint) setting it to 0x0 and 0xffffffff to switch a subgraph off/on. An advantage of NodeMasks is that can also be used in conjunction with the traversal masks, so you could just toggle whether whole groups of geometry/labels get visualized just by switching on different parts of traversal mask on the cull visitor.
Robert. On Thu, Apr 8, 2010 at 10:39 AM, Jesper D. Thomsen <[email protected]> wrote: > Hi all, > > > > I’m using OpenSceneGraph to show an interactive modelview for a > muscular-skeletal modeling application. In this view there are a number of > graphical objects which should only be viewed some of the time. I have > attached a screenshot with all such objects of a single category turned on > (the green lines with text attached), but normally only a few would be shown > at a time. I’m currently creating the entire OSG graph for the modelview > window at load, and turn these components on/off by removing and adding > their drawables to the Geodes. Each geode maximally has a few (about 0-5) > drawables, and I have several thousand geodes in total in the OSG graph. So > far, this method of doing show/hide has worked fine, but I’m now doing > picking using both LineSegmentIntersector and PolyTopeIntersector with each > mouse-click in the window (to handle draggable objects), and I’m getting > some pauses when I have a lot of objects hidden (that is, their geodes have > no drawables attached). The pauses happen during the call to accept(picker), > and are 1-5 seconds on a current machine. If I make everything visible (all > geodes have drawables), no pauses occur during picking. My question is if it > discouraged to have lots of geodes with no drawables in them, and would it > be better to also remove the geodes/transforms from their osggroups in the > graph? > > > > I also notice that I’m getting picking hits on visually empty space near the > model from geodes with no drawables attached. I had the impression that the > picker would only give me hits if I clicked a drawable of some sort. Can > this be caused by having removed drawables from geodes, which somehow cache > some kind of hit-box? > > > > On to another matter: In the OSG graph I have a large number (hundreds) of > osgtext objects with identical text textures, but with different positions > (as seen in the attached screenshot). As it is relatively slow to generate > all these identical textures, I would like to reuse the texture for the > osgtext’s, but I can’t find an example of how to do this. Or can I just have > a single osgtext attached to multiple transforms, and thus do the instancing > that way? > > > > I’m using OSG 2.6.1 and Visual Studio 2005 sp1 on Windows XP/Vista/7 > computers. > > > > If I have been unclear on anything, please ask me to elaborate. > > > > Regards, and thanks in advance for any advice. > > > > Jesper D. Thomsen > > AnyBody Technology A/S > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

