[osg-users] When and how to release an osg::Image

79 views
Skip to first unread message

Joachim Diepstraten

unread,
Jan 19, 2010, 9:30:35 AM1/19/10
to osg-...@lists.openscenegraph.org
Hello,

I am not sure if this has been asked before I tried a search on this forum but I think it is too specific so the search didn't come up with anything remotely close.

Anyway my question is is there a safeway to release osg::Image after it has been uploaded to the card or better say into it's memory space. Deconstructors of osg::Image are all protected so I don't know how you could actually tell it unless I write my own memory manager for it, which is possible (but I would rather like to avoid that).

The reason I ask is I've got quite a big volume stored in an osg::Image and I am running rather low on system resource memory the reason for that is it is actually kept twice in memory (the first time in osg::Image and the second time around due to OpenGL's / OS internal texture memory context mapping). So I rather would like to get rid of at least of one of them.

But I don't know when and how since I just recently restarted using OSG.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=22893#22893

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Garrett Potts

unread,
Jan 19, 2010, 10:01:53 AM1/19/10
to osg-...@lists.openscenegraph.org
Hello:

the osg::Image object is referenced object and will be automatically deleted once the final ref count goes to 0. On the osg::Texture object you can specify if you want OSG to unref the image object after the image has been applied by using the method:

setUnRefImageDataAfterApply

I think that should be it.

Take care

Garrett

Joachim Diepstraten

unread,
Jan 19, 2010, 11:40:53 AM1/19/10
to osg-...@lists.openscenegraph.org
Thank you for your reply Garret,

That is very handy to know.

Unfortunately it seems that none of the members in the osgVolume namespace expose this function (at least I couldn't find it), have something similar or are somehow related through inheritance to the osg::Texture class.

So I guess I have to look at the osgVolume code itself and find where it actually generates the 3D texture and add this line?

I am just slightly worried that this might cause unknown side effects!

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=22900#22900

Reply all
Reply to author
Forward
0 new messages