Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

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?

0
Posted

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?

0

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

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123