Dynamic Batching in OpenGL-ES

i am preallocating VAOs for my batches. For every frame, i am adding each object into batch and while adding i update VBOs using glMapBufferRange(), with this I am not getting 40-50 fps with around 70 draw calls. I have very limited counter data with profiler so i cann’t find out whether the bottleneck is updating VBOs or not.

In another approach, I dont update batch every frame. as I ecnounter new object which has not been occured till now in previous frames, i add it into batch. But problem with this approach is i still pass some of the objects’ data to GPU which fails frustum culling test on CPU as I am not removing those objects from the batch. With this one I get 55-60 fps with the same app.

I though first approach would be better and updating VBOs shouldn’t cause low fps. But i am suspecting as i am on mobile it is causing bottleneck. I want to know some ideas and thoughts over my existing approach or any better way of updating batch.

Updating buffer objects in any form of pre-AZDO OpenGL has these performance characteristics. The general guidelines are (1) if you can get away without updating at all, do so, (2) a small number of large updates are better than a large number of small updates, (3) don’t update part of the buffer that may still be in use for a pending draw call, and (4) the various usage flags are just hints and the driver is going to whatever it thinks is best anyway, which may sometimes be completely the opposite of what you actually want.

Regarding your specific case: are these objects static, and do you have many of them in total? It may well be an option to just upload all static objects one-time-only to a buffer object, then use e.g. the first and count parameters of a glDrawArrays call to draw ranges of the buffer for non-culled objects.

[QUOTE=mhagain;1282971]

Regarding your specific case: are these objects static, and do you have many of them in total? It may well be an option to just upload all static objects one-time-only to a buffer object, then use e.g. the first and count parameters of a glDrawArrays call to draw ranges of the buffer for non-culled objects.[/QUOTE]

I am using glDrawElements(). If i do upload one-time only and decide to use first and last parameter, then i will have to make separate draw calls to avoid rendering object which failed frustum cull test, which voids the purpose of batching.