I turned OFF the depth buffer reading and writting. I'm rendering something on top of a previous render. Is there a way to query the current depth buffer (from the previous render) and test it against the current fragment being drawn ?
My goal is to change the color when something is behind a geometry. gl_FragDepth, and gl_FragCoord.z seems to give me the current fragment depth being rendered, but not the value of the depth buffer at this fragment location.
Is there a way to achieve this ?