Jump to content
  • Advertisement
Sign in to follow this  
Xrystal

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

This topic is 4449 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 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);
m_mesh->SetVertexBufferData(m_PNCVerts,LockFlags::None);
m_mesh->SetIndexBufferData(m_indices,LockFlags::None);
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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!