PDA

View Full Version : How to properly render objects in my case? (VBO)



OpenGLNewbieGuy
11-23-2014, 01:55 AM
Hey guys.

My VBO contains vertices, that belong to numerous objects. These objects can have varying ZOrder (changeable at runtime) and may or may not be drawn (culled or disabled or not initialized).
What i'm currently doing is: i loop through each object in a sorted enumerable, check if objects is drawable (if not - skip iteration), get the stored position in VBO for current object and issue glDrawArrays for one single object.
Although this is very easy to do, i feel like making 100-1000-5000 glDrawArrays per render frame is bad. Due to the nature of the engine structure described above i can't as easily check if some optimization will actually help (would take a lot of planning).
My questions is: would that have an impact? And if so, can you suggest a way to alleviate the pressure on glDrawArrays?
Thanks in advance.