• Advertisement
Sign in to follow this  

How best to use mutliple meshes?

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

How should I set up my project for using multiple meshes in DirectX? Should I use multiple vertex buffers or should I prefer to use one? Should each object keep it's own information and then just pass it along to the render function? I've been trying to find information on how to best implement this simple stuff, without much luck though.

Share this post


Link to post
Share on other sites
Advertisement
If, by "mesh," you mean ID3DXMESH, then each mesh by its construction has it's own vertex buffer and you haven't much choice and must render them individually. If your app doesn't require a very high framerate, bookkeeping and materials may be easier to code for with separate meshes.

Having a single vertex buffer is generally preferable for performance, particulary if all your objects have the same vertex structure*. You can index each object separately (perhaps still in one large index buffer), either rendering it or not, or just rendering parts of it. Each object can still maintain it's own information and "render itself."

*You can size a vertex buffer for the largest vertex structure that will be used and simply use the stride for the largest structure when you render any of the objects.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement