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::pair<int, 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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org