MeshView gets a textured object, but I don't

Started by
3 comments, last by danne89 19 years, 6 months ago
Hi all (again), I'm trying to render a mesh, which is loaded from a .x-file. The problem is that I got none texture information at all, but the DirectX SDK's MeshView got it! How come? I'm really confused about this, guys and need help. PS. I'm using managed DirectX if that matter and I'm using the methods in Tom Miller's "Managed DirectX"-book. // Daniel
http://www.cis.gsu.edu/~shong/oojokes/
Advertisement
This means you're not loading or setting the textures correctly when you load/render it.
Ok. If that the case, let's be a little more technical then. I do something like this:
Mesh tempMesh = Mesh.FromFile(file, MeshFlags.Managed, device, out mtrl);

All entries in mtrl's members's TextureFilename is null. =(
http://www.cis.gsu.edu/~shong/oojokes/
Hmm. Here you have some more code if it's requiered.
        public Ship(Device device)        {            this.device = device;            ExtendedMaterial[] em;                  mesh = Mesh.FromFile(path, MeshFlags.Managed, device, out em);            if (em != null && em.Length > 0)            {                materials = new Material[em.Length];                textures = new Texture[em.Length];                for (int i = 0; i < em.Length; i++)                {                    this.materials = em.Material3D;                    if (em.TextureFilename != null && em.TextureFilename != string.Empty)                        this.textures = TextureLoader.FromFile(device,                            @"..\..\" + em.TextureFilename);                }            }        }        public void Draw(float yaw, float pitch, float roll, Vector3 pos)        {            this.device.Transform.World = Matrix.RotationYawPitchRoll(yaw, pitch, roll);            this.device.Transform.World *= Matrix.Translation(pos);            for (int i = 0; i < materials.Length; i++)            {                this.device.Material = this.materials;                this.device.SetTexture(0, this.textures);                mesh.DrawSubset(i);            }        }
http://www.cis.gsu.edu/~shong/oojokes/
Maybe, you should move the post to the .NET section?
http://www.cis.gsu.edu/~shong/oojokes/

This topic is closed to new replies.

Advertisement