Hi Randall,

Its expensive to pass ref_ptr<> around on the stack as they call
ref()/unref() for each temporary ref_ptr<> created, one a ref() for
the final destination.  If the Object has a ref count mutex on it then
the cost of this can be high.

It would of course be safe to pass back a ref_ptr<> to try and prevent
"potential" abuse by end users, however, I'm very much of the
inclination that we should assume users know what they are doing and
not to code things in a way that adds extra performance overhead  that
might help out users who don't know what they are doing.

OpenGL also has the same policy, it doesn't go round trying to catch
and fix every naughty usage of it, its designed to be fast.

Robert.


On 11/5/06, Randall Hopper <[EMAIL PROTECTED]> wrote:
     Got a question I've been meaning to ask for a while.

     Don's excellent "Using Reference Pointers" paper mentioned that it was
OSG's policy was to always use ref_ptr's unless there was a circular
reference possibility.

     However, all of the Geometry::get*Array() functions that return Array
objects return naked pointers instead of osg::ref_ptr<Array>'s.  Why is
that?

Thanks,

Randall
_______________________________________________
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