Hi,

I have a vertex array that I would like to draw.
The data can change from frame to frame so I did


_points = new osg::DrawArrays(osg::PrimitiveSet::POINTS);
_points->setDataVariance(osg::Object::DYNAMIC);


I added that and some vertices to my geometry.
I kept a pointer to the vertices to reuse it each frame.

To draw it I was doing:


if(some_number != _vertices->size()) {

   _vertices->resize(some_number, osg::Vec3());

   _points->setCount(some_number);

}


for(unsigned i(0); i != some_number; ++i)

   //copy data into the vertex array


Should be rather intuitive what the variables are...
Thing is,  though the array changes the contents are not redrawn...
Yet if I do each frame:

_vertices = new osg::Vec3Array(some_number);

_geometry->setVertexArray(_vertices.get());

_points->setCount(some_number);

for(unsigned i(0); i != some_number; ++i)
   //copy data into the vertex array


Then the contents are drawn correctly.
But I thing it does not make sense to create a new array every frame.
osg::Vec3Array even has the vector methods for resizing etc...
What am I doing wrong? Do I need to call some method to flag that the array changed?


Thank you

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to