Hi Can,

A Vec3Array is a subclass from std::vector<> so a points->clear() will
clear the array itself.

A Vec3Array is also subclassed from osg::Referenced so it has
reference counting built it, and the easiest way to manage this is via
the ref_ptr<> smart point.  See the documentation/KnowledgeBase
section for an article on ref_ptr<>.

Bascially all you'll need is:

  osg::ref_ptr<osg::Vec3Array> points = new osg::Vec3Array();

And you're done, everything will be cleaned up when points goes out of scope.

Robert.



On 5/2/06, Can Özmen <[EMAIL PROTECTED]> wrote:
Hi,

I have a Vec3Array I use for temporary storage of vertices inside a
function, which I declared with:

osg::Vec3Array* points = new osg::Vec3Array();

and then added vertices with push_back( ).

I'd like to delete the vector and its members before exiting the
function. I subclassed ValueVisitor to delete the vertices, but don't
know how to delete the Vec3Array itself. Am I doing something wrong?

Regards,
Can.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to