A depth buffer, or z-buffer, holds one depth per pixel, initialised to the far plane; a triangle’s pixel is drawn only if its depth at that pixel is smaller than the one stored, which it then replaces. Back-face culling drops, before rasterisation, every triangle of a closed surface that faces away from the camera; with the triangles of every surface listed in the same order seen from outside, it is the triangles whose screen order is reversed.
zbuffer.c writes: the two triangles cross along the line where their depths are equal, and each is darker where it is farther. No order of drawing the two whole triangles would give this picture.