Hi,
Firstly, I create a region of 6.000 points. They are computed randomly to make
an ellipsoid.
Then, "I have to" build my Delaunay in a CullCallback.
Each points are multiplied by the modelViewProjectionMatrix and send to
DelaunayTriangulator ( because with my points in 3d, delaunay doesn't work
!!!).
Thus, Delaunay is computed at each frame ... I've only 15 FPS...
It is possible to generate the Delaunay just once and note in a cullcallback ?
My code in cullcallback :
Code:
// _vSmpPt : Vec3Array with points in 3D space
for (unsigned int i = 0 ; i < _vSmpPt->size() ; ++i)
temp->push_back(_vSmpPt->at(i) * modelViewProjectionMatrix);
osgUtil::DelaunayTriangulator* delo = new
osgUtil::DelaunayTriangulator(temp.get());
bool result = delo->triangulate();
osg::ref_ptr<osg::DrawElementsUInt> primitiveTriangles = delo->getTriangles();
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(drawable);
geom->setVertexArray(temp.get());
geom->removePrimitiveSet(0,geom->getNumPrimitiveSets());
geom->addPrimitiveSet(primitiveTriangles.get()); geom->setUseDisplayList(false);
geom->setUseVertexBufferObjects(false);
Thank you!
Cheers,
Kévin
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=15455#15455
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org