Original Post
Hi everyone! I am seeking one problem right now && it is about Loading .X models from files. PS.I just borrow Tom Miller's book "MDX kick start: G & G programming", and i must say it is one of the best i had ever.It is true that it is a bit too old(some codes wont work), but then head to the Z-Buffer and download August2005 Source, and everything work perfectly The problem is, somewhat with textures...Here is a source: =============================================================================================== //Load Mesh <- located in InitializeGraphics LoadMesh(@"C:\Program Files\Microsoft DirectX SDK\Samples\Media\Tiny\tiny.x"); =============================================================================================== And the rest a.k.a Full LoadMesh Class =============================================================================================== private void LoadMesh(string file) { ExtendedMaterial[] mtrl; // Load our mesh mesh = Mesh.FromFile(file, MeshFlags.Managed, device, out mtrl); // If we have any materials, store them if ((mtrl != null) && (mtrl.Length > 0)) { meshMaterials = new Material[mtrl.Length]; meshTextures = new Texture[mtrl.Length]; // Store each material and texture for (int i = 0; i < mtrl.Length; i++) { meshMaterials = mtrl.Material3D; if ((mtrl.TextureFilename != null) && (mtrl.TextureFilename != string.Empty)) { // We have a texture, try to load it meshTextures = TextureLoader.FromFile(device, @"..\..\" + mtrl.TextureFilename); } } } } =============================================================================================== I get an error at this line: meshTextures = TextureLoader.FromFile(device, @"..\..\" + mtrl.TextureFilename); Error message: Invalid DataException Any ideas guys?!