To initialise it I use:
and I'm shutting it down with the following method:String pluginsPath;
// only use plugins.cfg if not static
#ifndef OGRE_STATIC_LIB
pluginsPath = m_ResourcePath + "plugins.cfg";
#endif
m_pRoot = OGRE_NEW Ogre::Root(pluginsPath, m_ResourcePath + "ogre.cfg");
#ifdef OGRE_STATIC_LIB
m_StaticPluginLoader.load();
#endif
if(!m_pRoot->showConfigDialog()){
return false;
}
m_pRoot->initialise(false);
NameValuePairList misc;
/*misc["FSAA"] = "0";
misc["contentScalingFactor"] = "2";
misc["displayFrequency"] = "0";*/
misc["colourDepth"] = "32";
misc["contentScalingFactor"] = "2.0";
misc["FSAA"] = "0";
//misc["orientation"] = "Landscape Right";
//m_pRenderWnd = m_pRoot->createRenderWindow("OgreWindow",1536,2048,true,&misc);
m_pRenderWnd = m_pRoot->createRenderWindow("OgreWindow",768,1024,false,&misc);
m_pSceneMgr = m_pRoot->createSceneManager(ST_GENERIC, "SceneManager");
MeshManager::getSingletonPtr()->setBoundsPaddingFactor(0);
// Warm Flourescent 255, 244, 229
m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0,0,0));
//this->customiseEngine();
this->createViewports();
this->createResources();
m_pRoot->setFrameSmoothingPeriod(0);
m_pTimer = OGRE_NEW Ogre::Timer();
m_pTimer->reset();
m_pRenderWnd->setActive(true);
this->initializeRTShaderSystem(m_pSceneMgr);
this->setupShadows();
I ran a test case where I started Ogre, loaded a model, destroyed Ogre, navigated to another screen, started Ogre again, loaded the same model and then checked the profile. The attached image shows the results of the current memory footprint. It seems a number of textures are being created by loading images through the createEntity method when the model is loaded but are not cleaned up after ogre is destroyed. Can anyone tell me why this might be occurring? I am deleting the root and trying to clean up as much of the resources as possible but it seems these bits are being missed. Is there a method I have missed or something else I should be doing?m_PitchDestQuart.~Quaternion();
m_YawDestQuart.~Quaternion();
m_RollDestQuart.~Quaternion();
m_pRenderWnd->destroy();
m_pRenderWnd = NULL;
//m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_NONE);
//m_pSceneMgr->setShadowCameraSetup(0l);
//m_pSceneMgr->setShadowTextureReceiverMaterial("");
//m_pSceneMgr->setShadowTextureCasterMaterial("");
shadowCamera.setNull();
#ifdef USE_RTSHADER_SYSTEM
mShaderGenerator->removeSceneManager(m_pSceneMgr);
finalizeRTShaderSystem();
#endif
m_pRoot->destroySceneManager(m_pSceneMgr);
/* The ogre ray cast */
delete ogreRay;
if(m_pRoot != NULL){
//m_pRoot->removeFrameListener(snapshotFrameListener);
m_pRoot->shutdown();
delete m_pRoot;
m_pRoot = NULL;
}
/* Access to timer */
delete m_pTimer;
/* Access to log */
delete m_pLog;
#ifdef OGRE_STATIC_LIB
m_StaticPluginLoader.unload();
#endif
Thanks