To main page |

Depth Testing

Depth testing is a process by which pixels on screen are tested against depth buffer.

Depth testing function is set by
glEnable(GL_DEPTH_TEST); // this enables depth testing
and then by
glDepthTest(GL_LESS); // this sets function for depth testing
calls. Most widely used is GL_LESS argument, which specifies that (after rasterization) pixels that have z coordinate in screen space LESS than z coordinate for that pixel in depth buffer ARE drawn, others are discarded.