Render .X Files using DrawIndexedPrimitive

Started by
6 comments, last by adriano_usp 20 years, 8 months ago
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.
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.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
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)
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
Pipo, thank you. I will do what you said.
Why bother copy all those things???? Just get the vb and ib from the model and use them directly.
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]
what if you AddRef to the VB and IB and then release the mesh?

I think this will work...

This topic is closed to new replies.

Advertisement