durium
30-10-2012 14:19:24
Hello world !
I have a problem when using mogre. When i try to create a mesh via ManualObject like this :
I then display it on the scene and assign it a material:
However, the material doesn't seem to be assigned. It is found : it don't have the have you forgotten to define it in a .material file error.
Here is my .material file :
What is wrong with my code ?
I have a problem when using mogre. When i try to create a mesh via ManualObject like this :
ManualObject block = this.mSceneMgr.CreateManualObject("block");
block.Begin("Cube", RenderOperation.OperationTypes.OT_TRIANGLE_LIST);
block.Position(new Vector3(0, 0, 0));
block.Position(new Vector3(0, 100, 0));
block.Position(new Vector3(100, 100, 0));
block.Position(new Vector3(100, 0, 0));
block.Triangle(0, 1, 2);
block.Triangle(2, 3, 0);
block.End();
block.ConvertToMesh("blockMesh");
I then display it on the scene and assign it a material:
Entity ent = mSceneMgr.CreateEntity("Head", "blockMesh");
ent.SetMaterialName("Cube");
SceneNode node = mSceneMgr.RootSceneNode.CreateChildSceneNode("HeadNode");
node.AttachObject(ent);
node.Yaw(new Degree(180));
However, the material doesn't seem to be assigned. It is found : it don't have the have you forgotten to define it in a .material file error.
Here is my .material file :
material Cube
{
technique
{
pass
{
ambient 1.0 1.0 1.0
diffuse 1.0 1.0 1.0
texture_unit
{
grass_1024.jpg
}
}
}
}
What is wrong with my code ?