Sign in to follow this  

[MDX] Problem creating a Mesh from Vertex and Index Buffers

Recommended Posts

I just found an item within the help files about the Mesh object. I've not been using meshes yet so not really looked into it until I see that someone had created a mesh from a set of vertices. So I looked at the example code and tried to implement it. But no luck. I have an array of vertices (PositionNormalColored) and an array of indices (Int16 which I believe is the equivalent of short). Now my program works fine without Meshifying the object made up of this array but when I try and generate the mesh using the following code:
m_mesh = __gc new Mesh(m_faceCount,m_vertexCount,meshflags,m_cvformat,m_device);
Int32 adjacency[] = __gc new Int32[m_mesh->NumberFaces * 3];
m_mesh->GenerateAdjacency(0.01F, adjacency); 
m_mesh->OptimizeInPlace(MeshFlags::OptimizeVertexCache, adjacency); 
m_numSubSets = m_mesh->GetAttributeTable()->Length;

So I basically create an object that uses my vertices and indices values (in a generic primitive class) and then I create a mesh from the values before I do anything else with it. Unfortunately this piece of code when I step through it doesn't seem to fill the Buffer or Array values and ultimately crashes out when trying to display it as a mesh. [edit] just changed title to better label the reason for posting. [Edited by - Xrystal on June 10, 2006 10:41:33 PM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this