how do i get the depth value of a pixel of an image,which i chose by a mouseclick ??
will i be able to get pixel information abt a point on the image by mentioning the depth value ,even if the point isnt visible in the image due to an overlying pixel ??
You get pixel information with glReadPixels. Mouse position is nothing OpenGL deals with, so you have to rely on your windowing API for that.
But you won’t be able to get information about occluded pixels. Simply because the frame buffer and depth buffer are two dimensional buffers. You can only get information about the pixel that is visible at the point where you call glReadPixels.
You cannot get the depth of a “hidden” pixel unless you disabled depth writes when the overlying pixel was drawn.
To get depth of the visible pixel use readpixels. You will have to convert to eye space coordinates. This is slightly trick.
Here’s the conversion: