The open gl es 2.0 extension, OES_depth_texture, enables writing of depth information to frame buffer with an attached texture.
However, the spec not describe the usage of glReadPixels with such an extension. As far as I can tell glReadPixels will not work with such a Frame Buffer (I've tried, and get the invalid operation error).
Am I correct in this assumption? Does anyone know another reference to this issue? Or is there an alternative for reading from the attached texture to using glReadPixels?
See OES_depth_texture:
There is no direct way. You can only do it indirectly. If you want to read out a deep texture, you need to do the following steps:
Create a framebuffer the same size as the deep texture
Use a shader to read the deep texture and write it in the color attachment of the frame buffer.
Use
glReadPixelsto read the color buffer.There may be an alternative for Nvidia hardware that supports the NV_read_depth extension:
Unfortunately I did not find a corresponding OES extension.
It is not possible to read the depth buffer directly. See OpenGL ES 3.2 Specification - 16.1.2 ReadPixels