Dynamic loading/changing textures

vandamme

12-12-2006 16:07:31

Do you know if it is possible to dynamically load/change textures on an object with Mogre while application is running.
It seems that we can't do that by using material scripts in .material files.

Bekas

12-12-2006 17:28:53

You can dynamically create and/or manipulate materials; for example:
entity.GetSubEntity(0).GetMaterial().GetTechnique(0).GetPass(0).GetTextureUnitState(0).SetTextureName("mytexture.jpg");

vandamme

12-12-2006 18:49:34

Great !!

Thks a lot.

vandamme

12-12-2006 18:49:53

Great !!

Thks a lot.

vandamme

13-12-2006 09:53:50

I have tested it with Entity it works fine.
But, it doesn't work on a ManualObject instance (I don't have the GetMaterial() method on a manual object).
I have also tried with the GetMaterial() method of the SceneObject englobing the ManualObject but it doesn't work.
Does - it mean that a shoud save meshes of a ManualObject in a file in order to use it as an Entity to dynamically change texture ?

Bekas

13-12-2006 10:11:58

You can get the Material from the MaterialManager; if it's the material of the ManualObject, it will get the effect.

If you want to use the ManualObject as an entity, read this: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=2892&highlight=manualobject+entity

vandamme

14-12-2006 14:13:43

I didn't make it with MaterialManager.
But it works fine by converting ManualObject as an entity.
Thks.