Depth Test

Is there any way for the programmer to know which plane is in front of another one if there are two planes in the view? OpenGL knows that with Z Buffer, however, how can I know this?

Our project: we need to retrieve some information from planes in the view. We only try to get information from the front most plane. So we need to know which plane is the front most one. Is there any way to do that?