Hi,
I am currently trying to use osgUtil::DelaunayTriangulator to triangulate a
mesh from a point cloud (which seems to work fine). I would like to visualize
the mesh using an osg::Geometry, the object seems to be visible in the scene
but it is completely black (all my other objects show fine).
I guess I am making a very simple mistake here, do you have any tips on how to
fix my problem?
Thank you!
Cheers,
Markus
p.s. my code:
Code:
osg::ref_ptr<osg::Group> mesh_group = new osg::Group();
osg::ref_ptr<osgUtil::DelaunayTriangulator> delaunay_triangulator = new
osgUtil::DelaunayTriangulator;
delaunay_triangulator->setInputPointArray( m_current_obstacle_points );
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array;
delaunay_triangulator->setOutputNormalArray( normals.get() );
delaunay_triangulator->triangulate();
osg::ref_ptr<osg::Geometry> gm = new osg::Geometry;
gm->setVertexArray( m_input_points );
gm->addPrimitiveSet( delaunay_triangulator->getTriangles() );
gm->setNormalArray( delaunay_triangulator->getOutputNormalArray() );
gm->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
osg::Vec4Array* colors = new osg::Vec4Array(1);
colors->push_back( osg::Vec4(0.658823529f, 1.0f, 0.705882353f, 1.0f) );
gm->setColorArray( colors );
gm->setColorBinding( osg::Geometry::BIND_OVERALL );
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(gm.get());
mesh_group->addChild(geode);
m_scene->addChild( mesh_group );
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52601#52601
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org