Hello Ignazio,

I must apply a changing to an osg::ShapeDrawable element,not a osg:Node.Is 
possible apply an update call back to a Drawable?

Please see the OSG reference docs.
http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00185.html#08ef7a88aa216afff5b072bf03ae6969

virtual void setUpdateCallback (UpdateCallback *ac)
Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal.

I'm trying to apply the method the Allen axplain, but if you are a method to 
change color by update call back,please explain your method..Thanks a lot.

It's really a matter of preference. Some people like inserting code into the update loop like Allen explained, some prefer encapsulating the behavior in callbacks and then letting the object update itself. I think the code of the update callback would be shorter and easier to understand, but I suspect this by experience and might be wrong.

Plus, in some cases you don't have control over the update loop, or don't want to clutter it with code for all the objects you will have to change... Making update callbacks makes things more local and more self-contained.

As for changing the color of a ShapeDrawable, please look at the docs for osg::ShapeDrawable, the examples, and the mailing list archives as it's really a basic operation to do. Maybe do a search in the OSG examples source code, looking for setColor?

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