Replacing the BaseTexture

Yellow

04-08-2006 15:27:44

In a side project, I'm trying to generate dynamic terrain, islands in this case. I'm generating a heightmap, and use part of the mapsplitter code to process it.

All go's well terrain wise, but when my new terrain is loaded in, it still uses the old texture. Is there some way to uncache it?

I tried the following stuff:

Ogre::MaterialManager::getSingleton().unload("BaseTexture");
Ogre::MaterialManager::getSingleton().load("BaseTexture","PLSM2");

Ogre::MaterialManager::getSingleton().reloadAll();

mSceneMgr->setOption( "CurrentTextureFormat", &String("BaseTexture"));

PatrickB3

04-08-2006 22:06:59

OK, this is really just a guess since I never had to do what you are doing, but it is an educated guess. ;)

Materials and Textures are NOT the same. If 10 materials use the same texture the texture is loaded once and the other nine refernce it. As such I do not believe reloading the material will by you anything as it will know the texture is already loaded.

I would visit the Texture Manager. Pretty sure it has ways of reloading a texture.

Falagard

04-08-2006 23:07:40

Yes, I'm sure that's what it is.


TexturePtr texture = TextureManager::getSingleton().getByName(textureName);
if(!texture.isNull())
texture->reload();

Yellow

05-08-2006 03:11:59

Right... Yeah, I convinced myself that reloading the material would also reload the texture...

Sorry about that, reloading the actual texture works like a charm, thanks!