Implementing lightweight rendering queues in OpenGL
All our previous rendering examples in this book were built with the assumption that an indirect draw call renders the entire collection of loaded meshes using the currently bound shader program. This functionality is sufficient to implement simple rendering techniques, where all the meshes can be treated the same way—for example, we can take the entire scene geometry and render it using a shadow-mapping shader program. Then, we take exactly the same scene geometry and render it entirely using another shader program to apply texture mapping. As we try to build a more complex rendering engine, this approach immediately breaks because different parts of the scene require different treatment. It can be as simple as different materials or as complex as having opaque and transparent surfaces, which may require completely different rendering code paths.
One naive solution to this problem would be to physically separate the actual...