I am currently working on a Graphics Engine for a 2D game with OpenGL, but I have issues implementing a viable solution for partial transparency, since opaque objects need to be drawn first, and transparent objects from back to front.
Specifically, I want to be able to pass render commands in an arbitrary order, and let the Engine handle the sorting.
My current approach is that I simply collect all vertices and textures of each transparent object in a sorted list, and at the and of each frame, I simply draw them from this list.
Although I get correct results, this is obviously not a viable solution, due to a lot of copy instructions. In case I have a few thousand partially transparent particles, this approach does not work at all due to its low performance.
I did not find any other way to implement this for 2D Graphics, so my question is: What is the most common approach to this ? Are there any sources where I can read more about this topic?
I use glBlendFunc(GL_SOURCE_ALPHA, GL_ONE_MINUS_SRC_ALPHA) by the way.