depth buffer is used to determine visibility, that is, which primitives in the
scene are visible to the camera, and which are occluded by
other primitives. This is an example of hidden
depth buffer, or z-buffer
simply an image that stores, for each pixel, a depth value in the range [0, 1].
rendering, the depth buffer is cleared. During
rasterisation, a fragment’s distance (in eye coordinates) from the camera is
compared with the value stored in the depth buffer.
the fragment is closer to the camera, its colour is updated along with the
code, the algorithm isif ( fragment.z < depthBuffer(x,y).z )