Hi Basil,
On 16/06/11 14:50 , Jean-Sébastien Guay wrote:
> Instead try:
>
> for each T in trajectoryList{
> osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
> //---- new ----
> osg::ref_ptr<osg::DrawArrays> drawArrayLines =
> new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP);
> osg::ref_ptr<osg::Vec3Array> vertexData = new osg::Vec3Array;
> //---- end new ----
> geom->addPrimitiveSet(drawArrayLines);
> geom->setVertexArray(vertexData);
>
> //line width, color, etc set here
>
> for each point in T{
> vertexData->push_back(osg::Vec3d(point.X,point.Y,point.Z));
> }
> drawArrayLines->setFirst(0);
> drawArrayLines->setCount(vertexData->size());
> geode->addDrawable( geom.get() );
> }
In addition to what J-S has said, take care that you're adding a *new* Drawable
to the
geode every time, so that might be the cause of your problem as well.
Either create a new Geode every time (and *replace* the previous one) or remove
previous
Drawables before setting the new trajectories.
HTH,
/ulrich
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org