Original Post
I created a mesh from an x file and now I want to save the indexbuffer to a file. To do this I need to lock the buffer but I can''t seem to get it working. This is the exception that I get:
System.ArgumentNullException: Value cannot be null.
Parameter name: elementType
at System.Array.CreateInstance(Type elementType, Int32 length)
at Microsoft.DirectX.Direct3D.IndexBuffer.Lock(Int32 offsetToLock, Type typeIndex, LockFlags flags, Int32[] ranks)
at Microsoft.DirectX.Direct3D.IndexBuffer.Lock(Int32 offsetToLock, LockFlags flags)
at SMB3D.Mesh.Save(String file) in c:\dxsdk\samples\c#\direct3d\testmesh\model.cs:line 184
I''m trying to lock it with an offset of 0 and LockFlags.None.
I don''t see why it''s not locking, the annoying thing is that I just did this the other day, but I mistakenly saved over the file.
Please help me figure out what I''m doing wrong.