Hi
 
I've one run into similar issue when was compiling some sample under linux, in my case it was solved by adding -rdynamic flag to gcc, i think there are some similar option to your compiler about exporting symbols.
 
Cheers.
 
07.02.2013, 08:35, "Philip Lamb" <[email protected]>:
Hi all,
 
I'm running into an interesting bug in my code which manifests as behaviour that works on one platform (Windows) and not on another (OS X) with the same OSG code. (Using OSG trunk, around 3.1.4)
 
I am using the following node visitor to reset animations attached to transform nodes:
 
class ResetAnimationNodesVisitor : public osg::NodeVisitor
{
public:

    

    ResetAnimationNodesVisitor():
    osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}

    

    virtual void apply(osg::Transform& transform)
    {
        osg::NodeCallback *nc = transform.getUpdateCallback();
        osg::AnimationPathCallback* apc = dynamic_cast<osg::AnimationPathCallback*>(nc);
        if (apc) {
            apc->reset();
            apc->update(transform);
        }
        traverse(transform);
    }
};
 
This visitor is instantiated on a node thus:
 
void resetAnimationTime(osg::ref_ptr<osg::Node> modelNode)
{
    ResetAnimationNodesVisitor ranv;
    modelNode->accept(ranv);
}
 
When compiled and run on an animated model under Windows (compiled with Visual Studio 2010 SP1) all works as expected. When the exact same code is compiled and run under OS X (using Xcode 4.5.2, with LLVM 4.2.1) the dynamic cast to osg::AnimationPathCallbackis always NULL.
 
I have checked that RTTI is not disabled (it's on by default, and no errors are produced by the dynamic_cast<>, and that indeed things are as expected with this snippet inside apply():
 
        if (nc) osg::notify(osg::NOTICE) << "UpdateCallback: className is " << std::string(transform.getUpdateCallback()->className()) << " and type_id.name() is " typeid(transform.getUpdateCallback()).name() << std::endl
 
which produces the output:
 
UpdateCallback: className is AnimationPathCallback and type_id.name() is PN3osg12NodeCallbackE
 
So it looks like a failure somewhere in RTTI. Both typeid and the dynamic_cast<> fail to convert the osg::NodeCallback* to an osg::AnimationPathCallback*. Yet clearly, the callback IS the right type, as evidenced by OSG's className() function's output.
 
Any ideas about where this kind of issue might be coming from?
 
Regards,
Phil.
,

_______________________________________________
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

Reply via email to