We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2444 - glReadPixels() fails to read offscreen pixels
Summary: glReadPixels() fails to read offscreen pixels
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.2
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-11 08:28 UTC by Andrew Church
Modified: 2014-10-22 09:47 UTC (History)
1 user (show)

See Also:


Attachments
Sample code demonstrating bug (1.37 KB, text/x-c-code)
2014-03-11 08:28 UTC, Andrew Church
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Church 2014-03-11 08:28:59 UTC
Created attachment 1590 [details]
Sample code demonstrating bug

In SDL 2.0.1 and 2.0.2 on Linux, if an OpenGL window is positioned such that part of its content area is offscreen, glReadPixels() will fail to read pixels from the offscreen parts of the window.

This is a regression from SDL 1.2.15.
Comment 1 Andrew Church 2014-03-11 08:39:42 UTC
For reference, on my system (FVWM 2.6.5 with a 31-pixel top border and 7-pixel left border on windows, screen size 1920x1440), the test program fails with the following output when built against SDL2:

Pixel 0,0 not read
Pixel 1,0 not read
[...]
Pixel 1918,30 not read
Pixel 1919,30 not read
Pixel 1913,31 not read
Pixel 1914,31 not read
Pixel 1915,31 not read
Pixel 1916,31 not read
Pixel 1917,31 not read
Pixel 1918,31 not read
Pixel 1919,31 not read
Pixel 1913,32 not read
Pixel 1914,32 not read
[...]
Pixel 1918,1439 not read
Pixel 1919,1439 not read

When built against SDL 1.2.15, the test program reports no errors.
Comment 2 Sam Lantinga 2014-04-18 06:00:40 UTC
Hey Pierre-Loup, do you know what's going on here, and whether this is expected?
Comment 3 Pierre Phaneuf 2014-04-19 17:19:41 UTC
Wrong Pierre here, and I don't see a Pierre-Loup in the completions?
Comment 4 Sam Lantinga 2014-04-19 17:20:20 UTC
Whoops, sorry about that!
Comment 5 Carsten 2014-10-22 09:10:51 UTC
For OpenGL pixels that are off-screen or obscured by other windows have undefined contents, see https://www.opengl.org/wiki/Pixel_Ownership_Test#Pixel_ownership_test for more info.

If this worked before it probably was by accident and it is outside of the control for SDL to do anything about it.
Comment 6 Andrew Church 2014-10-22 09:47:57 UTC
Agreed, I found the same problem with a native GLX test so it's probably a GL driver issue (NVIDIA in my case).  SDL 1.2 uses the old XVisualInfo method rather than GLXFBConfig so maybe the GL driver does different things in the two cases.