Hi Alexandre,

Doing a texture->setImage(image) will do unref the old image before
assigning and ref'ing the new one, so memory management should work
just fine.  The memory leak you are percieving is almost certainly not
down to the core OSG code like Texutre::setImage.  I'd recommend that
you double check you own code, and also how you are monitoring the
memory leak, as sometime the memory tracking tools produce false
positives.

As a general comment, I'd also recommend use osg::ImageStream (as
subclass from osg::Image) as a base for streamed images, the xine and
quicktime plugins both have movie reading code that provide their own
subclass from osg:::ImageStream so have a look at these for
inspiration.

Robert.

On Fri, May 9, 2008 at 6:34 PM, alexandre amyot murray
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> please forgive my english...
>
> I'm developping an interractive application where people's movement affect
> the content of a 3D scene. Somewhere in the appication, when people move,
> planty of small insects appears and follow their hands. I modelized these
> insects by a small square plane on wich I apply a sequence of PNG image to
> give them life. I use texture rectangle to display the images. I made my own
> class that manage the sequence of PNG images. So when I make a call to
> MyOwnStreamingClass.getNextFrameToDisplay(), it returns me the next image to
> display.
>
> To change the image of the textureRectangle of each insect, I do the
> following :
>
> --   AInsectTextureRectangle.setImage(
> MyOwnStreamingClass.getNextFrameToDisplay() );
>
> But this way, I got a memory leak. I tought that a call to texture.setImage
> would delete the last image and replace it by the new one., but it don't
> seems to.
> So I try another way to change the image :
>
> --   osg::Image* nextImage = MyOwnStreamingClass.getNextFrameToDisplay();
>
> --   osg::Image* textureImage = AInsectTextureRectangle.getImage();
> --   textureImage.setImage( ...,   ...,  nextImage .data(), ... );
>
> But it doesn't work either, in fact I got a runtime error this way.
>
> So I would like too know how I should proceed ?
>
> The PNG images are of size 40x40 and a sequence is made of 100 images. I can
> have like 50 insects at the same time in the scene.
>
> Thanks in advance
>
> Alexandre
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to