Hello Igor,

Oh, your example seems very helpful, as it gave me a way to get rid of long 
"blah->blah-blah", but is it ok to use osg::Vec3Array with "*" ? I thought it 
might cause memory leaks.

Memory leaks come from allocating memory which you fail to deallocate later when it's not needed anymore. Or even worse, allocating memory repeatedly and losing any reference to the old allocated memory. This can cause the program to continue allocating memory for nothing, eventually using up all available memory in the system.

Here, the objects have been loaded for you by OSG, and you're accessing their vertex array directly (casting the osg::Array* that comes from Geometry::getVertexArray() to an osg::Vec3Array*). You're not allocating anything, just accessing the data that's there using its concrete type instead of its base class type. So no, that won't cause a memory leak.

I suggest you review the concepts of memory allocation and pointers, as well as classes, inheritance and casting (dynamic_cast in particular) if this is not clear to you.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to