Archived

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

Vertex buffer for each mesh?

Recommended Posts

rubberkidney    122
Would it be unwise to create a vertex buffer for each mesh that I have in a scene? Or would it be better to just keep a buffer of my own design..then when the time comes concatonate them all into one big vertex buffer?

Share on other sites
if you are just starting out, keep it simple, i.e. as many VBs as there are objects - or for example make an array of the class.

Later you can optimize it and stuff it into one big vertex buffer or into several ones depending on FVF structure and just change the starting vertex and amount being rendered.

The reason for not optimizng from the very beginning is that it is easier to debug and later you shall find out that simple nonindexed vertex buffers are not enough and youll switch to indexed vertex buffers. Basically the best (and easiest to implement) is One big vertex Buffer and several dynamic Index Buffers - especially for terrain, or if you have objects placed in 2d grid throughout whole level.

The difference in speed is however tremendous. When I had my terrain divided in about 100 VBs and later did one Big VB with IB, the framarate rose about 200%. So its up to you how comfortable are you currently with VBs and IBs.