[osg-users] how to eliminate a texture from an object???

Robert Osfield robert.osfield at gmail.com
Tue Sep 18 11:55:58 PDT 2007


Hi David,

The OSG uses ref_ptr<> that should ensure that no memory leaks occur,
but.. this  does seem assume they your own application is using them -
if you code fragment it does which is good practice.  Another
possibility w.r.t memory leaks is a false positive - VS's memory
tracking tool is buggy.  Beyond this there isn't much we can add
without knowing your application much more closely.  In the end this
will have to be down to you to track down and solved.  In general the
OSG is pretty solid w.r.t memory management.

Robert.

On 9/18/07, David _ <solid_davidian at hotmail.com> wrote:
>
>  Hi
>
> we´re using right now a lot of pagelod nodes and sometimes we generate some
> new textures and put them over these nodes so they have the original texture
> in texture id number 0 and the new one in number 1
>
> we want to delete the number one texture, not the original one, so it can be
> replaced by an updated one which sometimes has different resolution, so an
> update of the existing one is not possible, we want to delete and replace by
> another one
>
> this is how we´re putting the new texture over the older one. It has some
> alpha so decal is needed
>
> osg::ref_ptr<osg::StateSet> stateset = geom->getOrCreateStateSet();
> osg::ref_ptr<osg::TexEnv> modo_tex = new
> osg::TexEnv(osg::TexEnv::DECAL);
> stateset.get()->setTextureAttributeAndModes(1,new_text,osg::StateAttribute::ON);
> stateset.get()->setTextureAttribute(1, modo_tex.get(),
> osg::StateAttribute::OFF);
>
> how would you delete it if you want to replace it in the future????
>
> right now we´re just overwriting it, but we´re having memory leaks....
>
> thanks
>
>
> ________________________________
> Busca desde cualquier página Web con una protección excepcional. Consigue la
> Barra de herramientas de Windows Live hoy mismo y GRATUITAMENTE. Pruébalo
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>



More information about the osg-users mailing list