Page 1 of 1

[SOLVED] 1.10 to 1.11 textures not found but image file exists

Posted: Wed Feb 13, 2019 4:33 am
by glennr
Ogre Version: :1.11:
Operating System: :Windows 10:
Render System: :D3D9, OpenGL:

In our app we colourise our models by creating textures as PNG files and load them using the code below. This was working in 1.10 but in 1.11 we get FileNotFoundException from the mat->applyTextureAliases(texNameList) call.

Code: Select all

	// Use the original material as a template, clone it and update the texture image

        Ogre::MaterialManager &mm = Ogre::MaterialManager::getSingleton();

        // Get an existing material
        Ogre::MaterialPtr mat = mm.getByName(materialName);
            Ogre::MaterialPtr templateMat = mm.getByName(templateMaterialName);
            mat = templateMat->clone(materialName);

            bool ok = mat->applyTextureAliases(texNameList); // FileNotFoundException here in 1.11

            Ogre::TextureManager &tm = Ogre::TextureManager::getSingleton();

            Ogre::AliasTextureNamePairList::iterator iend = texNameList.end();
            for(Ogre::AliasTextureNamePairList::iterator i = texNameList.begin(); i != iend; ++i)

	return mat;
The directory where the PNG files are created has been added to the resource manager like this:

Code: Select all

ResourceGroupManager::getSingleton().addResourceLocation(mediaPath, "FileSystem", "General");
I suspect this is related to the new behaviour of the resource manager, however setting OGRE_RESOURCEMANGER_STRICT to 0 (LEGACY) from 2 (STRICT) doesn't help.

What do I need to do to make this work again?

Re: 1.10 to 1.11 textures not found but image file exists

Posted: Wed Feb 13, 2019 11:48 am
by paroj
yes, with 1.11 Ogre only uses the index it creates at addResourceLocation - it does not longer fall back to searching the filesystem again.
Therefore if the texture was not there in the first place it will not be found.

You can re-create the index by removeResourceLocation/ addResourceLocation after you created the file. See the manual for details: ... ement.html

Re: 1.10 to 1.11 textures not found but image file exists

Posted: Thu Feb 14, 2019 7:45 am
by glennr
Thanks, that did the trick. It was as easy as doing this prior to a scene load:

Code: Select all

		ResourceGroupManager::getSingleton().removeResourceLocation(mediaPath, "General");
		ResourceGroupManager::getSingleton().addResourceLocation(mediaPath, "FileSystem", "General");
I still have a possibly related issue, but will start a new topic for that.