Overlapping polygons

I was wondering, can OpenGL handle this problem:

http://www.javaengines.dk/images/overlap.PNG

Triangle Red overlaps Green, Green overlaps Blue but blue also overlaps red…
Surely something better than sorting polys and drawing them sequentially must be done, since no general absolute ordering works for polys in 3D space?

If you absolutely needed to draw things in the right order, you’d have to split at least one of the polys based on the planes of the others, then sort the remaining fragments. Fortunately though you can just use a Z-buffer :slight_smile:

Well if Red has Z=3, Green has Z=2 what Z must Blue have then? No number greater than 3 and smaller than 2 exists ;p

Edit: Ok, I guess I was a little too fast then, so the Z-value is actually painted for each pixel?
Thanks, this is something that has been puzzling me ever since I first read about the painters algorithm.