Hello,

For the answer, I suggest you revise the C++ docs about dynamic_cast<> and also check the class hierarchy of OSG's node types.

dynamic_cast<A*> succeeds for any pointer to an object of class A or any pointer to an object of a derived class of A. So even if you don't have a proper Group at the root, if you have any object of a derived class of Group (like osg::MatrixTransform, osg::Switch, etc.) it will succeed.

Check out Node::asGroup() (reimplemented in osg::Group) for an alternative to dynamic_cast (trades a dynamic_cast which is pretty costly for a virtual method call which is much less costly).

Hope this helps,

J-S

On 21/08/2012 3:49 PM, Peterakos wrote:
Hello.

I forgot to mention that i check it. That's why i posted it. Cause it is very strange to run even though there is no group as root..

osg::ref_ptr<osg::Group> node = dynamic_cast<osg::Group*>(osgDB::readNodeFile( "astroboy_walk.dae" ));
if(!node) {
   std::cout << "Model could not be loaded " << std::endl;
   return 1;
}

thank you.


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
______________________________________________________
Jean-Sebastien Guay              jean_...@videotron.ca
                    http://whitestar02.dyndns-web.com/

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to