Jump to content
  • Advertisement
Sign in to follow this  

help on managed vbs and ibs...

This topic is 5200 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

Hi, I made a parser for a 3d model file, and now I want to display the model using managed direct3d. How can I fill the vertex buffers and index buffers with the info I get from the parser, and then render it? From the parser I can access to the regular stuff (faces, meshes, vertices, indices...)... Any help? Thanks

Share this post

Link to post
Share on other sites
I don't know how you do it in managed, but here's the general idea.

// Vertex Buffer
1. Create a vertex buffer
2. Lock the vertex buffer
3. Fill the vertex buffer
4. Unlock the vertex buffer

// Index Buffer
1. Create the index buffer
2. Lock the index buffer
3. Fill the index buffer
4. Unlock the index buffer

// Render
1. Set the Stream Source to the vertex buffer
2. Set the FVF bits
3. Set the mesh's transform IF NEEDED
4. Call DrawIndexedPrimitive to draw the mesh

You first need to decide how you're going to represent each primitive in your mesh. Will they be a simple triangle list, triangle strips, or triangle fans? With this knowledge, you can fill the vertex buffer and (if needed) the index buffer.

You probably know all of this, so here's a good link to start you off:

MSDN Library

Also check out Drunken Hyena's tutorials.


Share this post

Link to post
Share on other sites
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!