I am using the GL selection buffer to implement mouse picking. Unfortunately, OpenGL is returning hits in the selection buffer even for objects that are entirely occluded. For example, if there is a man hidden behind a wall, the selection buffer will include a hit record for the man even though he is not visible.
Selection is implemented in roughly the way described in the OpenGL Programming Guide: switch to the GL_SELECT render mode -- glRenderMode(GL_SELECT) -- render the scene, and then parse the selection buffer. The depth buffer and depth testing are enabled, but GL seems to ignore depth settings in GL_SELECT mode.
Is it possible for OpenGL to do depth culling in GL_SELECT mode? Is there another way of discarding hit records for hidden objects without re-implementing selection using another method?