Jump to content
  • Advertisement
Sign in to follow this  

Getting Textures from a Mesh

This topic is 3953 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using XNA to create some basic simulation. I created a model using 3D World Studio. Which I then exported to a .X file. I am using an effect file i created to light the scene. One of the parameters of the effect file is the texture that needs to be drawn. What is the best way to get the textures associated with a mesh during my drawn method? Here is the loop of my draw method:
foreach (ModelMesh mesh in buildingModel.Meshes)
                roomLighting.Parameters["World"].SetValue(transforms[mesh.ParentBone.Index] * Matrix.Identity);
                roomLighting.Parameters["modelTexture"].SetValue(currentTexture);  // <---- how do i get currentTexture

                foreach (ModelMeshPart meshPart in mesh.MeshParts)

                    graphics.GraphicsDevice.Vertices[0].SetSource(mesh.VertexBuffer, meshPart.StreamOffset, meshPart.VertexStride);
                    graphics.GraphicsDevice.VertexDeclaration = meshPart.VertexDeclaration;
                    graphics.GraphicsDevice.Indices = mesh.IndexBuffer;

                    foreach (EffectPass pass in roomLighting.CurrentTechnique.Passes)
                             meshPart.BaseVertex, 0, meshPart.NumVertices, meshPart.StartIndex, meshPart.PrimitiveCount);

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!