From 9ebffd40556c1d1d70680bd408f20942fdb6c4e1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 19 Jan 2004 11:02:54 +0000 Subject: [PATCH] Added support for osg::Texture::setUnRefImageDataAfterApply(true) into all objects osg::Textures the TXP plugin creates. --- src/osgPlugins/txp/TXPArchive.cpp | 3 +++ src/osgPlugins/txp/TXPParser.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/osgPlugins/txp/TXPArchive.cpp b/src/osgPlugins/txp/TXPArchive.cpp index 5f80793db..de4a4816d 100644 --- a/src/osgPlugins/txp/TXPArchive.cpp +++ b/src/osgPlugins/txp/TXPArchive.cpp @@ -130,6 +130,9 @@ bool TXPArchive::loadMaterials() // Create a texture by name. osg::ref_ptr osg_texture = new osg::Texture2D(); + + // make sure the Texture unref's the Image after apply, when it is no longer needed. + osg_texture->setUnRefImageDataAfterApply(true); // Load Texture and Create Texture State std::string filename = osgDB::getSimpleFileName(texName); diff --git a/src/osgPlugins/txp/TXPParser.cpp b/src/osgPlugins/txp/TXPParser.cpp index e6092ff0c..34bb50057 100644 --- a/src/osgPlugins/txp/TXPParser.cpp +++ b/src/osgPlugins/txp/TXPParser.cpp @@ -1176,6 +1176,9 @@ osg::Texture2D* txp::getLocalTexture(trpgrImageHelper& image_helper, const trpgT { osg_texture = new osg::Texture2D(); + // make sure the Texture unref's the Image after apply, when it is no longer needed. + osg_texture->setUnRefImageDataAfterApply(true); + osg::Image* image = new osg::Image; char* data = 0L; @@ -1246,6 +1249,9 @@ osg::Texture2D* txp::getTemplateTexture(trpgrImageHelper& image_helper, trpgLoca { osg_texture = new osg::Texture2D(); + // make sure the Texture unref's the Image after apply, when it is no longer needed. + osg_texture->setUnRefImageDataAfterApply(true); + osg::Image* image = new osg::Image; char* data = 0L;