I'm gradually making progress in learning to use OpenTK to make a 2D game.
I'm using some variation of the following code to use an orthographic projection, such that I place all my Quads parallel to the Z=0 plane, with Z between 0 and 1.
GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(0, Width, Height, 0, 0, 1);
My next question is around layers, i.e. priority of drawing order.
No matter which Z I choose, the images always appear in the order of draw calls, presumably because the Orthographic projection flattens everything. This has the benefit that images are drawn direct to screen coordinates at the right size, but I lose the ability to set layers using position.
The question is, is there a way of using the Matrix Modes to allow Z coordinate to define the layer the image is drawn on, or do I have to implement code to sort the draw orders?
If my only option is the latter, I have code I can reuse from some old AS3 games (basically presorting the images when their layer value is set, so no sorting algorithm is needed within the Render calls).