[osg-users] Converting PrimitiveSet to use triangles instead of triangle strips / fans?

Jad Killian m.hasani at outlook.com
Wed Aug 15 00:09:36 PDT 2018


When I import a .obj file with readNodeFile, the result is a triangle strip instead of triangles. Even if the .obj file is a simple square with 4 vertices and 2 triangular faces, the resulting primitive set in the geode geometry contains
1 face, 4 indices with mode = 5 (TRIANGLE_STRIP).

I tried using the osg::Optimizer, but it doesn't seem to do anything:

osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filepath.toStdString());

osgUtil::Optimizer optimizer;
optimizer.optimize(node, osgUtil::Optimizer::INDEX_MESH);

for optimizer flags I tried INDEX_MESH, TESSELLATE_GEOMETRY, DEFAULT_OPTIMIZATIONS, nothing seems to work.

Any ideas?


Read this topic online here:

More information about the osg-users mailing list