1. If you use osg::ref_ptr for your Texture2D objects, they should be
cleaned up when you remove any references to them (ie just remove the
geode(s) the texture is attached to or any other references to the texture)
2. bad_alloc usually means you're running out of memory.
On Fri, Jul 26, 2013 at 2:48 AM, Nat Doublet doub...@cgxaero.com wrote:
Hi,
I cut an image in 16*16 bitmap files (12M each). I want to put one by one
in an osg::texture2d, after use, I want to unload it just after (to avoid
trouble with memory).
My code is :
[code]
std::pairint, int XY = std::make_pair(ix, iy);
osg::StateSet* p_stateSet = geode-getOrCreateStateSet();
osg::Texture2D* texture = new osg::Texture2D();
texture-setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::REPEAT);
texture-setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT);
std::string fileImg = p_mapXYImgFileName.at(XY);
texture-setImage(osgDB::readImageFile(fileImg, p_option));
p_stateSet-setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
geode-setStateSet(p_stateSet);
p_stateSet-releaseGLObjects();
[/code]
2 questions :
1. because I cannot call texure2d destructor (same for stateset), am I
right to try to free memory with releaseGLObjects? (my computer don't want
to manage with 2Gb of data loaded)
2.After iterations on X, Y (not always the same number), I go a bad
allocation error on the texture-setimage()...
[code]
Exception Microsoft C++ : std::bad_alloc à l'emplacement mémoire
0x0019c54c.
bad allocation
[/code]
Have you got an idea? some wayround?
Thank you!
Cheers,
Nat
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55454#55454
___
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