I'm writing a rendering subsystem for my game and would like to know what I should aim for in terms of drawing order. Some points on the game's rendering:
-The rendering is pretty simplistic, it just uses texture billboard quads (i.e. rotated to always face the viewer) for every creature / item, each of which appear on a polygonal terrain / surface.
-I don't need z-buffering since I'm using partly-transparent textured quads to give the illusion of form. I use the painter's algorithm instead.
-The game is for fairly standard-grade x86/64 desktop systems (standard OpenGL, not ES).
For the render order, so far I have this:
by depth (necessity for accurate draw order / painter's algorithm)
-by program (context changes here must be costly!)
--by texture in program (I have *heard* that texture context changes are costly...)
---by mesh that uses that texture(glVertexAttribPointer, not horrifically costly?)
----by discrete entity transform (every entity using this mesh)
Does this order make sense? I have no idea how to go about this decision, except by ordering from what I think is the most expensive context switch (to happen least frequently), down to the least expensive (to happen most frequently). I would love to be able to put program before depth, but obviously that would break the painter's algorithm! Also I don't know if "render by texture" is in the most suitable place here. In fact, unless someone shows me a better way, I will probably have just one shader program for all my in-game objects because otherwise it's going to lead to a LOT of shader program changes. That would lead to:
by program
-by depth
--by texture
---by mesh
----by discrete entity transform




