Hello guys,
I'm trying to retrieve the number of vertices of a mesh described in an obj
file. I use the function osgDB::readNodeFile(fileName) to load it and the
following one to get that number:
int Mesh::getVertNum()
{
// Convert the node m_obj into a Group pointer and return child node at
position 0
osg::Geode* geode =
dynamic_cast<osg::Geode*>(m_obj->asGroup()->getChild(0));
osg::Geometry* geometry = geode->getDrawable(0)->asGeometry();
osg::Vec3Array* vertex =
dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray());
return vertex->getNumElements();
}
But the thing is it doesn't give me the correct number. I tried with a
simple cube and I obtained 24 vertices.
Someone already had that problem in this message:
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2008-September/016855.html
but
I'm not sure to well understand, and also I still don't know how to get the
correct number.
Does anyone have an idea?
Thank you guys
--
Nicolas
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org