• Advertisement

Archived

This topic is now archived and is closed to further replies.

Render .X Files using DrawIndexedPrimitive

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

Hello for all, I have a beginning question, so please have patience, OK? I know DrawSubset is not the fastest method to render meshes, then I''m trying to use index buffer to get performance gain. In other words, I would like to render a .x file using DrawIndexedPrimitive method, but I am not getting . Please, what are the steps? Where could I find a code sample? Thank you for your patience.

Share this post


Link to post
Share on other sites
Advertisement
DrawSubset already uses an index buffer. The reason it''s inefficient is because it sets the vertex and index buffers ever time you call it, even if they were already set. All you have to do is call GetVertexBuffer() and GetIndexBuffer() (or whatever they are really called) and then you can render them yourself.

Share this post


Link to post
Share on other sites
Raloth, thank you very much to explain about how DrawSubset works. I will try implement the code now.

Other doubt: Will the materials be affected by using the DrawIndexedPrimitive?

Thanks.
(sorry about my English)

Share this post


Link to post
Share on other sites
1) Make a VertexBuffer which the Mesh''es VertexBuffer can fit in.
2) Make an IndexBuffer which the Mesh''es IndexBuffer can fit in.
3) Lock both the VertexBuffers.
4) Lock both the IndexBuffers.
5) Copy data from the Mesh''es Buffers to the seperate Buffers.
6) Unlock all the Buffers.
7) Render with DIP().

.lick

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Why bother copy all those things???? Just get the vb and ib from the model and use them directly.

Share this post


Link to post
Share on other sites
Hmm.. Hmm.. Come to think about it.. AP are you right?
[edit]If you copy the Buffers you can release the Mesh object. Since the texture is seperate too.

.lick


[edited by - Pipo DeClown on August 18, 2003 5:06:49 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
what if you AddRef to the VB and IB and then release the mesh?

I think this will work...

Share this post


Link to post
Share on other sites

  • Advertisement