glReadPixels on GL_DEPTH_COMPONENT fails on resize

I’m running OpenGL on an ATI equipped FIREGL on a Thinkpad.
I use glReadPixels to read the depth buffer. However, when a resize to enlarge my window and viewport, glReadPixels returns depth values of 0 in the
enlarged areas of the window (bigger than original size). Colour values return okay, but depth does not seem to work. The depth values do seem to be working though as my objects seem to honor the depth values when rendering, but I can’t seem to read them back properly.

I don’t get this problem on Nvidia cards. Is anyone aware of this bug? Is it ATI-specific?


its probably because those areas of the window contain no depth information yet …

You just want to draw the scene again and fill the buffer with depth values.


this issue might be become of the pixel ownership test: values outside of a window are undefined for both color/depth.

this corner case of the opengl spec is used by implementation in order to implement a specific techniques often used for professional application. Basically, if you have many overlapping windows, you could run out of memory if opengl was allocating buffers indepedently. Instead the implementation can chose to allocate one large buffer for all the windows, and sub allocate that buffer for each window in the 2d space.

Pierre B.
AMD Fellow