View Full Version : batching geometry

02-23-2011, 07:24 AM
would it make sense the take different types of geometry and put them into a single buffer? Doing this lessens the number of glbindbuffer calls but would it be worth it or should it be something decided after?

I actually use glbindvertexarray but I would think the same idea applies.

I do this for each object
glbindvertexarray(object id)
//draw elements

but if I batch them I could:
glbindvertexarray(object id)
glbindbuffer(GL_ARRAY_BUFFER, batch0);
//bind/draw elements for object 0
//bind/draw elements for object 3
//bind/draw elements for object 1

02-23-2011, 08:12 AM
It depends. If the number of glBindBuffer calls is a bottleneck in your program then it would make sense, otherwise you'll be getting into a lot of code restructuring for no gain.