You may take a look at :
http://andesengineering.com/OSG_ProducerArticles/RefPointers/RefPointers.html
regards
2008/4/9, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> I just started using OSG and have never used ref_ptr's before, though I've
> read the "A Short Introduction to the Basic Principles of the Open Scene
> Graph" and belive I understand the concept. But I wonder if you have any
> advice on the use of ref_ptr's on OSG objects, and If you use them in some
> standard way.
>
> I recon all the objects that inherits from "Referenced" should use ref_ptr
> for safer memory alloction/deleting, but I guess it's just a subjective
> choice.
>
> The tutorials though use "dumb" pointers as in the Basic Geometry example:
> "
> ...
> int main()
> {
> ...
> osg::Group* root = new osg::Group();
> osg::Geode* pyramidGeode = new osg::Geode();
> osg::Geometry* pyramidGeometry = new osg::Geometry();
> "
>
> but i guess it's just for simplicity.
>
> In the guide "A Short Introduction to the Basic Principles of the Open
> Scene Graph" on the use of ref_ptr, they first create a node using ref
> pointer, then they add a node using new, and say:
>
> "
> Line 25 does more or less the same thing as the previous case. The
> difference is that the geode is allocated with new and added as group's
> child in a single line of code. This is quite safe, too, because there are
> not many bad things that can happen in between (after all, there is no
> in between.)
> "
>
> that may be a little missleading since it's not a smart pointer, and needs
> to be deleted explicitly.
>
> Erlend
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
Christophe Loustaunau.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org