[osg-users] Converting a Drawable object to a Geometry object
Franclin Foping
fsfoping at yahoo.fr
Wed Jul 30 16:39:37 PDT 2008
Dear All,
I would like to turn a Drawable object into a Geometry counterpart in order to retrieve its texture coordinates.
I have tried to use both the asGeometry method of the Drawable class and the dynamic cast operator but both attempts ended up delivering a NULL pointer. I am not sure if there is another way of doing it.
Here is a code snippet.
osg::Geode myGeode = new osg::Geode;
myGeode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(),1,1,1)));
osg::Drawable* myDrawable = myGeode->getDrawable(0);
osg::Geometry* myGeom = myDrawable->asGeometry(); //This returns NULL!
osg::Geometry* myGeom2 = dynamic_cast<osg::Geometry *>(myDrawable);
Unfortunately both myGeom and myGeom3 are both NULL at this point.
What to do then, anyone to save me from embarrasment?
Anxiously waiting for your reply.
Franclin.
---------------------------------
Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080731/0b8c0b56/attachment-0003.htm>
More information about the osg-users
mailing list