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

David _ solid_davidian at hotmail.com
Tue Sep 18 13:22:20 PDT 2007


so, if i just do this to asign a new texture to an object
 
stateset.get()->setTextureAttributeAndModes(1, new_texture.get() ,osg::StateAttribute::ON);
in case that there is already a number one texture will the OSG free the previous texture and it´s image before replacing it with the new one???
 
every textures are ref_ptr of course
 
thanks
 
> Date: Tue, 18 Sep 2007 19:55:58 +0100> From: robert.osfield at gmail.com> To: osg-users at lists.openscenegraph.org> Subject: Re: [osg-users] how to eliminate a texture from an object???> > 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> >> >> _______________________________________________> osg-users mailing list> osg-users at lists.openscenegraph.org> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_________________________________________________________________
Consigue el nuevo Windows Live Messenger
http://get.live.com/messenger/overview
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20070918/1e258b21/attachment-0003.htm>


More information about the osg-users mailing list