   2D Tile Rendering Order
  Here's a question about rendering I have, It could be solved with just running through the map 4 times but then I'd have to do that with each layer and it'd get slow if I decided to add more layers. I believe it could possibly be solved with an OpenGL function.Also I have GLViewPort and GLOrtho set, as it is 2D.Let's say that I have a map, each map has multiple layers,Layer 0 = GroundLayer 1 = Transparent Objects Player Can Walk OverLayer 2 = Transparent objects Player Walks BehindEach layer is stored in an arrayMy rendering loop is suchfor (int X = minX; X < maxX; X++){    for (int Y = minY; Y < maxY; Y++)    {   layer0draw   layer1draw   playerdraw   layer2draw}}Now the problem is that when the next tile in layer0 or layer1 gets drawn, the player gets clipped behind it when they are moving because its being rendered on top of the player.So my question is, is there anyway I can basically sayAll the vertexes in layer0draw are to be drawn at the back,All the vertexes in layer1draw are to be drawn at the back,All the vertexes of the player are drawn in front of both layer0 and layer1,then All the vertexes in layer2draw are drawn in front the playerI've tried vertex arrays(put each set of tiles into a vertex array) but I couldnt get it to work with Ortho for some reason.   
  Normally you would draw a layer at time.layer0drawlayer1drawplayerdrawlayer2drawand to do a layer you do thefor (int X = minX; X < maxX; X++){  for (int Y = minY; Y < maxY; Y++) {   Draw tile(X,Y); }}   ;  so cause you are in ortho mode the depth value of a vertex doesn't effect the look(no perspectiv) so when you just give the vertices of each layer different z-values and use depthtesting they should be rendered in the correct way independend in which order they were drawn   