Sign in to follow this  

help on managed vbs and ibs...

This topic is 4861 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.

Chris

Share this post


Link to post
Share on other sites

This topic is 4861 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.

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