Hello,
I want render a texture on a mesh. The texture is loaded from a file. The mesh is created by the primitive mesh methode (e.g. Mesh.Box)
I'd read, that this meshes don't have meshcoordinates. So I cloned the mesh to a mesh with texturecoordinates.
But the texture isn't drawn.
Can anyone help me please? A source example would be helpful, because all examples I found load the mesh from a file, where the textures are defined, too.
Here is the source-code which I use.
Thanks
Kostarsus
I want render a texture on a mesh. The texture is loaded from a file. The mesh is created by the primitive mesh methode (e.g. Mesh.Box)
I'd read, that this meshes don't have meshcoordinates. So I cloned the mesh to a mesh with texturecoordinates.
But the texture isn't drawn.
Can anyone help me please? A source example would be helpful, because all examples I found load the mesh from a file, where the textures are defined, too.
Here is the source-code which I use.
Code:
Appearance appearance=(Appearance)m_appearance;
ImageTexture appTexture=(ImageTexture)appearance.Texture;
if (appTexture!=null){
Texture texture = TextureLoader.FromFile
(directXDevice,appTexture.Url.GetElementAt(i));
directXDevice.SetTexture(0,texture);
}
Microsoft.DirectX.Direct3D.Mesh tempboxMesh=null;
tempboxMesh=Mesh.Box(directXDevice,this.m_size.X,m_size.Y,m_size.Z);
Mesh boxMesh=tempboxMesh.Clone(tempboxMesh.Options.Value, tempboxMesh.VertexFormat | VertexFormats.Normal | VertexFormats.Texture0,directXDevice);
boxMesh.DrawSubset(0);
boxMesh.Dispose();
Kostarsus