Depending on your graphics board (NVIDIA based, for example) you might want to switch to 32 bits color. Then you can get pixelformats with 24 bits depth and 8 bits stencil. 16 bits color depth offer 16 bits Z and no stencil.
And the stencil buffer can do many more tricks than the z-buffer.
Nevertheless, the commands you need to know are glEnable(GL_DEPTH_TEST), glDepthRange(), glClearDepth(), glClear(GL_DEPTH_BUFFER_BIT), glColorMask() for not writing into the color buffer, glDepthMask() for enabling or disabling depth writes, maybe glScissor() and some good basics on projection and modelview matrices.
The default is that OpenGL maps the zNear and zFar values in glOrtho, glFrustum, or gluPerspective to window-z coordinates from 0.0 to 1.0 respectively.
With this it should be no problem to position visible or invisible polygons in the scene which lie at the desired depth.
Beware of rounding effects due to different numbers of depth buffer bits.