Added support for osg::MemoryManager which is based upon Paul Nettle's
memory manager published at flipcode.com. This can be turned on with the OSG_USE_MEMORY_MANGER option which then uses custom global new and delete operators as well as provide osgNew and osgDelete macro's which add ability to log line and file from which calls are made. Updated osg,osgUtil,osgDB,osgText and osgPlugins/osg to use osgNew/osgDelete, and fixed memory leaks highlighted by the new memory manager.
This commit is contained in:
@@ -192,27 +192,27 @@ Geode* osg::createGeodeForImage(osg::Image* image,const float s,const float t)
|
||||
float x = y*(s/t);
|
||||
|
||||
// set up the texture.
|
||||
osg::Texture* texture = new osg::Texture;
|
||||
osg::Texture* texture = osgNew osg::Texture;
|
||||
texture->setImage(image);
|
||||
|
||||
// set up the drawstate.
|
||||
osg::StateSet* dstate = new osg::StateSet;
|
||||
osg::StateSet* dstate = osgNew osg::StateSet;
|
||||
dstate->setMode(GL_CULL_FACE,osg::StateAttribute::OFF);
|
||||
dstate->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
dstate->setAttributeAndModes(texture,osg::StateAttribute::ON);
|
||||
|
||||
// set up the geoset.
|
||||
osg::GeoSet* gset = new osg::GeoSet;
|
||||
osg::GeoSet* gset = osgNew osg::GeoSet;
|
||||
gset->setStateSet(dstate);
|
||||
|
||||
osg::Vec3* coords = new Vec3[4];
|
||||
osg::Vec3* coords = osgNew Vec3[4];
|
||||
coords[0].set(-x,0.0f,y);
|
||||
coords[1].set(-x,0.0f,-y);
|
||||
coords[2].set(x,0.0f,-y);
|
||||
coords[3].set(x,0.0f,y);
|
||||
gset->setCoords(coords);
|
||||
|
||||
osg::Vec2* tcoords = new Vec2[4];
|
||||
osg::Vec2* tcoords = osgNew Vec2[4];
|
||||
tcoords[0].set(0.0f,1.0f);
|
||||
tcoords[1].set(0.0f,0.0f);
|
||||
tcoords[2].set(1.0f,0.0f);
|
||||
@@ -220,7 +220,7 @@ Geode* osg::createGeodeForImage(osg::Image* image,const float s,const float t)
|
||||
gset->setTextureCoords(tcoords);
|
||||
gset->setTextureBinding(osg::GeoSet::BIND_PERVERTEX);
|
||||
|
||||
osg::Vec4* colours = new Vec4[1];
|
||||
osg::Vec4* colours = osgNew Vec4[1];
|
||||
colours->set(1.0f,1.0f,1.0,1.0f);
|
||||
gset->setColors(colours);
|
||||
gset->setColorBinding(osg::GeoSet::BIND_OVERALL);
|
||||
@@ -229,7 +229,7 @@ Geode* osg::createGeodeForImage(osg::Image* image,const float s,const float t)
|
||||
gset->setPrimType(osg::GeoSet::QUADS);
|
||||
|
||||
// set up the geode.
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
osg::Geode* geode = osgNew osg::Geode;
|
||||
geode->addDrawable(gset);
|
||||
|
||||
return geode;
|
||||
|
||||
Reference in New Issue
Block a user