0
\$\begingroup\$

I am using XNA 4.0 and I wonder if drawing models with multiple meshes is better by filling the vertex and index buffers first and calling GraphicsDevice.DrawIndexedPrimitives() or by simply using good ol' foreach(...) {ModelMesh.Draw()}.

Is it possible to add data to vertex/index buffers at all in order to pack all the models on the scene in them and then call Draw only once per frame?

I would appreciate a link to an in-depth explanation. Thanks.

\$\endgroup\$
0
\$\begingroup\$

What I was looking for is called "instancing" or "batching". It is indeed faster to pile geometry before calling "Draw". An example with source code can be found here:

http://jcoluna.wordpress.com/2011/11/17/xna-light-pre-pass-instancing/

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.