Hi Cory,

I also have a toolbar button to turn labels on or off. What is the best
way to toggle the visible state of the osgText::Text instances when my
user asks to enable or disable these labels? I think I could make the
text transparent, but that feels wrong. Any suggestions?

If you want to toggle visibility of all your text elements under a same Geode, you can use the node mask on the Geode.

If you want to control visibility of each text element independently, you could create one Geode for each, which will consume more memory but might not matter depending on the number of text elements you have. Or you could use a Drawable::DrawCallback attached to each text element to decide if you want to draw the text or not (call the drawable's drawImplementation() or not). You could also subclass osgText::Text and override its drawImplementation() method to simply exit if some boolean attribute is false (like _visible).

So you have a few options. Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to