Operating System: Win 10
Render System: Directx 11
Hello guys,
Recently i have ported my app from DirectX9 to DirectX11, where the RTSS is new for me and i ran into some issues.
The RTSS works fine but some time i got errors.
Before the porting i used the following code, to create and edit materials during runtime:
Code: Select all
Ogre::MaterialPtr origMat = Ogre::MaterialManager::getSingletonPtr()->getByName( fullName );
Ogre::MaterialPtr copyMat = Ogre::MaterialManager::getSingletonPtr()->createOrRetrieve( copyName, group ).first.staticCast<Ogre::Material>();
origMat->copyDetailsTo(copyMat);
I could figure out that it was because of copyDetailsTo function. But i dont know the exact reason.
I solve the problem by the following code:
Code: Select all
Ogre::MaterialPtr copyMat = Ogre::MaterialManager::getSingletonPtr()->getByName(copyName);
if (copyMat.isNull())
copyMat = origMat->clone(copyName, true, group);
else
{
Ogre::MaterialManager::getSingletonPtr()->remove(copyName, group);
copyMat = origMat->clone(copyName, true, group);
}