My 2D OpenGL game is going to have 5 different types of objects I want to render.
-Text
-unTextured AABBs
-unTextured Polys
-Textured AABBs
-Textured Polys
Text will have its own shader and thats fine.
I want things to be simple to code but not insanely slow either. I'm willing to do a little bit of batching and texture atlasing for bulk things like Tiles which can be drawn all at once, but otherwise objects will be drawn in an unpredictable order and therefore requires some state switching.
Polys will need a matrix for rotation passed as a uniform but obviously AABBs won't. So I'm not sure if they need to be separate or not.
One way I thought of uses 3 shaders. One for text and two for rendering textured and untextured polys and AABBs. For AABBs I could just pass an identity matrix instead of a rotation matrix.
Another way just has 5 separate shaders.
I'm concerned with the amount of switching between different shaders I'll need to do since I already know my GUI renderer will have to switch between rendering text and AABBs (though I don't expect more than a few dozen total widgets and containers).
Since the tiles will be batched and are by far the most numerous object in my game, I expect an asbolute maximum of less than 150 different draw calls (with shader and texture switches).
Just wondering which approach between the two seems the most sensible or if there's another suggestion.