[osg-users] Problems with fuction viewer

Rafa Gaitan rafa.gaitan at gmail.com
Thu Jul 30 03:50:45 PDT 2015


Hi Alvaro,

As pointed by Christian all your problems are pure C++ problems. I
recommend you to learn more C++ and how to code to avoid leaks and memory
corruption and for OSG I recommend you get a copy of the Quick Start Guide.

Doing a quick review I've discovered that your are returning a pointer from
a local variable created inside "crearMultipleVenata" so after the function
returns that viewer is destroyed!. Use a raw pointer or even better a
osg::ref_ptr<>, but really you need to read about smart pointers in C++ and
also how the smart pointers are used in OSG :)

Also I recommend as a general rule use always English in the code (even for
the comments), using Spanish will be easy for you but others might don't
understand the meaning of the methods.

Regards,
Rafa.


El jue., 30 jul. 2015 a las 12:31, alvaro ginestar rodriguez (<
alvaroginestar at hotmail.com>) escribió:

> hi everyone !!. i have a problem with return viewer in a fuction, and to
> add the viewer of the fuction in de main.
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150730/c0af53cb/attachment-0003.htm>


More information about the osg-users mailing list