A while ago, I asked a question about how to properly organize your render loop (http://www.gamedev.net/topic/659636-good-render-loop-organization-resources).
Haegarr gave me some good advice about doing visibility culling and about putting specific render jobs for (among others) opaque and non-opaque objects in separate render lists.
In those rare moments that I do find time to work on my own projects, I have already implemented a basic octree implementation for visibility culling, but I am now faced with the problem of sorting my render lists.
As I understand, one would want to sort an opaque object render list from front to back, in order to trigger early z rejection, but I was wondering how you could combine this front-to-back sorting with sorting objects to minimize resource switching.
Correct me if I'm wrong, but either you sort objects by their distance to the camera, or you do it by some other criteria, but you can't do both right?