Jump to content
  • Advertisement
Sign in to follow this  
IronDonut

Texturing A Mesh (Managed)

This topic is 5144 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 have a Mesh object I've created and am rendering into my DirectX scene. I'd like to add a texture to it real time. Does anyone have any example code? int numVertex = targetMesh.SystemMesh.NumberVertices; CustomVertex.PositionNormalTextured[] verts =(CustomVertex.PositionNormalTextured[]) targetMesh.SystemVertexBuffer.Lock( 0, typeof( CustomVertex.PositionNormalTextured ), 0, targetMesh.SystemMesh.NumberVertices ); VertexBuffer vertexBuffer = new VertexBuffer( typeof( CustomVertex.PositionNormalTextured ), numVertex, device, Usage.WriteOnly, CustomVertex.PositionNormalTextured.Format, Pool.Default ); device.SetTexture( 0, texture ); device.SetStreamSource( 0, vertexBuffer, 0 ); device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, numVertex); targetMesh.SystemVertexBuffer.Unlock(); This is what I'm doing now and it's not working. Thank you.

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!