Archived

This topic is now archived and is closed to further replies.

nerdboy80

Creating mesh in c# from vertex data problem

Recommended Posts

Newbie to DX, so bear with me... I am doing the following: ------------------------------------------------- _trackMesh = new Mesh(300, 900, MeshFlags.Managed | MeshFlags.VbWriteOnly, CustomVertex.PositionNormal.Format, d); CustomVertex.PositionNormal [] vertdata2 = (CustomVertex.PositionNormal[]) _trackMesh.LockVertexBuffer(typeof(CustomVertex.PositionNormal), LockFlags.None); ------------------------------------------------- But, when I look at vertdata2 it reports it''s length as 0. Do I need to explicitly create the vertex buffer for this mesh? How would I do that? Thanks, NerdBoy

Share this post


Link to post
Share on other sites
You have to pass the number of vertices you want to lock as a third argument, ''ranks''. It''s a params[] argument so that''s why you were able to call the function without it -- but you don''t want to do that.

Share this post


Link to post
Share on other sites