• Advertisement
Sign in to follow this  

Texturing A Mesh (Managed)

This topic is 4961 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