Changing Materials at Runtime.
Posted: Thu Feb 24, 2005 1:17 pm
Simple prob I hope. I am simply just trying to change the material applied on one box to another using the setMaterialName();
I have 2 Boxes in my scene. I try to change the left box to use the right boxes Material but it always goes white and the error log always says that the material does not exsist. But it does as the right box is using it in the first place. I have checked that the name is correct. When changing the material to an already created entity is there anything you have to do for it to take effect?
Here is a pic. Trying to chnge 1 sub entity to the Box 2 material

And just to be completely exact. Here is the simple Material file beeing used. Know to OGRE as it uses them to begin with during loading.
I have 2 Boxes in my scene. I try to change the left box to use the right boxes Material but it always goes white and the error log always says that the material does not exsist. But it does as the right box is using it in the first place. I have checked that the name is correct. When changing the material to an already created entity is there anything you have to do for it to take effect?
Here is a pic. Trying to chnge 1 sub entity to the Box 2 material

And just to be completely exact. Here is the simple Material file beeing used. Know to OGRE as it uses them to begin with during loading.
Code: Select all
material Box2
{
technique
{
pass
{
ambient 0.113725 0 0.980392 1
diffuse 0.113725 0 0.980392 0
specular 0.9 0.9 0.9 0 0
}
}
}
material Box1
{
technique
{
pass
{
ambient 1 0 0 1
diffuse 1 0 0 0
specular 0.9 0.9 0.9 0 0
}
}
}