Anti-aliasing and glReadPixels(..GL_DEPTH_BUFFER...)

Hi, I have a question I hope someone here can help me with. I would like to do the anti-aliasing after all the primitives and environment settings are done, but I would also like to get the depth value of a pixel on the screen by using glReadPixels(). And I’m not too sure I can do it because once it is anti-aliased I don’t think a pixel my mouse is pointing at is still the original object.

But since I’m unexperienced with this I hope someone here can point me to the right direction.

Thanks in advance for any kind help.


As the name implies glReadPixels works on pixels, not on fragments. You’re not able to read the depth values from the multisample buffer with it.
The depth value xy-position you get is as exact as your screen (mouse coordinate) resolution. Subpixel exact depth picking doesn’t sound useful.