Hey guys, I looking for some advice/insights into render batching. I've been building my own game engine for Android (OpenGL ES 2.0) and at the moment, I feel like I am handling my game object rendering very inefficiently.
Currently, I have GameObjects that have are stored in a list in a GameWorld. GameObjects have a reference to a texture and a mesh. At the moment, all I do is loop through the GameObjects in my renderer, binding textures and unbinding them object by object. My understanding is that binding is quite an expensive process. So, I guess my question is... does anyone have an elegant way to handle this?
Some of the ideas I had were:
- Sort the GameObjects list on the texture id (possibly also expensive to do) so that objects with the same texture render together
- Instead of an array with everything in it, GameObjects of the same type are kept in their own arrays, and each one of those is looped through with only one 'bind' call required per group.
I hope I was clear enough to create some idea of where I'm at and what I'm trying to do, I can't wait to hear your feedback.