Mesh X = Mesh.FromFile( @"C:\car.x", MeshFlags.Dynamic, Device );
if( X != null )
{
Vertex[] Vertices = (Vertex[])X.LockVertexBuffer( typeof(Vertex), LockFlags.None, 0 );
ushort[] Indices = (ushort[])X.LockIndexBuffer( typeof(ushort), LockFlags.None, 0 );
}
What am I doing wrong?
MDX: Accessing the vertices/indices from a Mesh
I know you're supposed to use Mesh.LockVertexBuffer() and Mesh.LockIndexBuffer() but they are both returning nothing, even though the mesh is loaded correctly.
Are you sure that the vertex format of the mesh's vertices is the same as the Vertex struct? Also, are you sure you can pass zero for the third parameter (I ask because I don't quite understand how it's used from the documentation)?
Does it work if you use the overload that returns a GraphicsStream?
Does it work if you use the overload that returns a GraphicsStream?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement