[osg-users] Wrong vertex count when loading OBJ files.
mpistorius.osg at googlemail.com
Thu Sep 25 07:18:17 PDT 2008
I see a strange problem when I load OBJ files. I use osg::readfilenode() to
load an .obj with a known number of vertices, and then inspect the resulting
node to see how many vertices was loaded, like so:
osg::Node* node = osgDB::readNodeFile(
osg::Geode* g = dynamic_cast< osg::Geode*> (
osg::Geometry * gm = g->getDrawable(0)->asGeometry();
osg::Vec3Array * v = (osg::Vec3Array*) gm->getVertexArray();
std::cout << "verts: " << v->size() << std::endl;
I know my model has 7570 vertices (I inspected the contents of the file, and
this is also reported by other obj loaders I tried). but when osg loads
this file, it reports 'verts: 8369' in the code above. I need a one to one
mapping between osg's vertices and the ones specified in the obj file. Does
osg somehow try to automatically optimise the geometry when it is loaded,
i.e create triangle strips, etc.
Funny thing though, when I subsequently save the node to .obj using osg, it
saves it with the correct no of vertices.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users