Hi,
I have described referenced pointers in depth in my tutorials published on the
official wiki. Have a look at the dedicated tutorial and let me know if you are
still stuck!
Franclin.
Peter Hrenka <[EMAIL PROTECTED]> a écrit : Hi Vincent,
Vincent Bourdier schrieb:
> Hi all,
>
> I'm making some function to modify graph after some operation, and so I
> need to call some simple actions in functions.
>
> The problem is about ref_ptr :
>
> I need to do this :
>
> osg::ref_ptr mygroup;
> [..]
> mygroup = NULL;
> [...]
>
>
> To do that in a function, I use someting like :
> addonstack(mygroup, NULL); //prototype is :
> addonstack(osg::ref_ptr caller, osg::Node* arg1);
>
> which did this :
> osg::ref_ptr nd = dynamic_cast(caller.get());
> if(nd.get()){
> nd =arg1;
>
> But, the problem is that it doesn't change anything... I need, without
> making some modifications in the addonstack prototype, a way to put the
> ref_ptr to NULL .
>
> Any idea ?
> Thanks.
The addonstack function gets its own copy of the ref_ptr,
so it cannot modify the original ref_ptr.
To change the original ref_ptr you must change the signature to
addonstack(osg::ref_ptr& caller, osg::Node* arg1);
But the code above (with the ref_ptr called "nd") will still not
work, since this is yet another copy of caller. You use the
reference "caller" directly, e.g.
caller = arg1;
> Regards,
> Vincent.
Hope this helps
Peter
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Florian Geyer,
Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Prof. Dr. Hanns Ruder
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible
contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail _______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org