[osg-users] Wrong vertex count when loading OBJ files.

Rosario Leonardi rosario.leonardi at gmail.com
Thu Sep 25 11:56:50 PDT 2008


At rendering time every polygon attribute must correspond to the 
polygon, so (I guess that) if a vertex of your mesh have two normal (or 
two color) the loader have to split in the vertexes in two.
Try to load a mesh with only smooth edges and the vertexes count should 
be correct, than try to load a Cube, and if I'm right it should have 24 
vertexes.

At save time the vertexes can be grouped again.

Morné Pistorius ha scritto:
> Hi guys,
>
> 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:
>
>     //debug
>     osg::Node* node = osgDB::readNodeFile( 
> "C:/Data/Meshes/Hand3DIS/Hand3.obj" );
>     osg::Geode* g = dynamic_cast< osg::Geode*> ( 
> node->asGroup()->getChild(0) );
>     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.
>
> Any ideas?
>
> Thanks, 
> Morne
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rosario_leonardi.vcf
Type: text/x-vcard
Size: 136 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080925/5ce4ca80/attachment-0003.vcf>


More information about the osg-users mailing list