how do i read from the zbuffer?

ok, i need to read what is the z pos given a raster x,y position… how do i do it? sounds simple, but i don’t get it.

Use glReadPixels with a format parameter of GL_DEPTH_COMPONENT, and with a width and height of 1.

  • Matt