Quote:Original post by RPTD
What do you mean exactly by "batching" in this context? ( just to see if I have something similar to compare results )
By batch I mean
Create vertex buffer.
Create index buffer
While( !gameEnd )
Load mesh 1 vertices into VBO.
Load mesh 2 vertices into VBO.
Load mesh 1 faces into IBO.
Load mesh 2 faces into IBO.
Draw mesh 1.
Draw mesh 2.
Destroy VBO
Destroy IBO
The VBO/IBO is statically allocated and not created and destroyed for every iteration. In fact it is not even resized. If the vertex buffer fills up, we draw the geometry and restart from the beginning of the buffer.
Ok, I managed to do some more tests and it seems that glBufferSubData is indeed faster than glBufferData.
The engine uses chunks of vertex data in a continuous array that it loads using calls to glBufferSubData. I tried replacing glBufferData here and it was slower. The reason was glBufferData would replace all the data in the array and maybe do some internal memory allocation/deallocation. The glBufferData will take a hit on performance as the size of the VBO increases (big hit). So for a big VBO it is best to use glBufferSubData.