On Fri, 2007-02-02 at 20:27 -0500, Zach Deedler wrote:
> Hello,
>  
> osg uses smart pointers.  Most classes in osg are derived from
> osg::Referenced.  This class prohibits you from deleting it by making
> the destructor protected.  This is on purpose.  This way you don't
> have to worry about deleting objects.
>  
> There is a link for a tutorial on this, but I cannot seem to find it.
> Basically, if you create osg::Box, it will destroy itself when there
> are no references to it.  It gets references when it is added as a
> child of some other node.
>  
eg: 
void some_function(...)
(
    osg::ref_ptr<osg::Box> box_ptr = new osg::Box;

    // do stuff with osg::Box via box_ptr
} // the osg::Box will get deleted here when box_ptr goes out of scope

See http://donburns.net/OSG/Articles/RefPointers/RefPointers.html for
more details.

Don

-- 
"A government that is big enough to give you all you want
is big enough to take it all away." -- Barry Goldwater

+---------------+
|  Don Tidrow   |
|  Vis-Sim geek |
+---------------+

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to