So I would like to optimize my drawing calls to account for transparency.
Long story short, what I have been doing is sorting all of my OpenGL meshes from opaque to fully transparent before the scene is loaded and then drawing.
However, after reading, you must also sort from furthest to nearest.
The problem is I am not sure how this can be done dynamically in the scene with an std::vector or QVector based iteration of all of my objects I need to draw.
Consider the logical steps I am going through now:
[li]Load all of my objects into Computer RAM via loaders.
[/li] [li]With loaders I assign the correct materials to the object (colors, textures, etc.)
[/li] [li]Sort by transparency
[/li] [li]Load into OpenGL
[/li] [li]Draw into OpenGL using the rendering loop.
I guess what I am asking is how do people sort the objects drawn from furthest to nearest per frame based on the active camera position?
What’s the high speed way that I am missing?