Why don I get valid pixel data for an overlapped area when I call glReadPixels() where part of the window is overlapped by another window?
This is due to a portion of the OpenGL specification called the Pixel Ownership test. If a window is obscured by another window, it doesn’t have to store pixel data for the obscured region. Therefore, a glReadPixels() call can return undefined data for the obscured region. The Pixel Ownership test varies from one OpenGL implementation to the next. Some OpenGL implementations store obscured regions of a window, or the entire window, in an off-screen buffer. Such an implementation can return valid pixel data for an obscured window. However, many OpenGL implementations map pixels on the screen one-to-one to framebuffer storage locations and don’t store (and can’t return) pixel data for obscured regions of a window. One strategy is to instruct the windowing system to bring the window forward to the top of the window stack, render, then perform the glReadPixels() call. However, such an approach still risks user intervention that might obscure the source window. An approach that might work f