<div dir="ltr"><div><div><div><div><div>Hi Tony,<br><br></div>The OSG uses nested callbacks rather than pre/post callbacks that Performer uses.<br><br></div>Nested callbacks have the advantage that you can create local state in the callback that can be constructed and deleted within the lifetime of the callback, which is both more convenient, robust and thread safe than using pre/post callbacks that attempt to achieve the same behaviour.<br><br></div>Nested callbacks also allow you to override the traversal behaviour - allowing you to implement culling or multi-pass or simply custom traversal behaviour.<br><br></div>This makes things that were once very hard to do in Performer really easy and safe.<br><br></div>Robert.<br><div><div><div><br><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 31 August 2015 at 09:57, Tony Vasile <span dir="ltr"><<a href="mailto:minghia@gmail.com" target="_blank">minghia@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So what about the equivalent pre and post callbacks that Performer supports? Is it a case of copying the code in the example<br>
<br>
Code:<br>
<br>
class DrawableDrawCallback : public osg::Drawable::DrawCallback<br>
{<br>
        virtual void drawImplementation(osg::RenderInfo& renderInfo,const osg::Drawable* drawable) const<br>
        {<br>
            std::cout<<"draw call back - pre drawImplementation"<<drawable<<std::endl;<br>
            drawable->drawImplementation(renderInfo);<br>
            std::cout<<"draw call back - post drawImplementation"<<drawable<<std::endl;<br>
        }<br>
};<br>
<br>
class UpdateCallback : public osg::NodeCallback<br>
{<br>
        virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)<br>
        {<br>
            std::cout<<"update callback - pre traverse"<<node<<std::endl;<br>
            traverse(node,nv);<br>
            std::cout<<"update callback - post traverse"<<node<<std::endl;<br>
        }<br>
};<br>
<br>
<br>
<br>
<br>
and putting your own calls where the pre and post calls are?<br>
<br>
Tony<br>
<br>
------------------------<br>
<span class="">Tony V<br>
<br>
------------------<br>
Read this topic online here:<br>
</span><a href="http://forum.openscenegraph.org/viewtopic.php?p=64953#64953" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=64953#64953</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</div></div></blockquote></div><br></div>