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 3349 - GLES2_RenderReadPixels doesn't use target texture format
Summary: GLES2_RenderReadPixels doesn't use target texture format
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-28 19:13 UTC by Simon Hug
Modified: 2016-10-01 18:39 UTC (History)
0 users

See Also:


Attachments
Patch that fixes the incorrect format selection in GLES2_RenderReadPixels. (610 bytes, patch)
2016-05-28 19:13 UTC, Simon Hug
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Hug 2016-05-28 19:13:01 UTC
Created attachment 2471 [details]
Patch that fixes the incorrect format selection in GLES2_RenderReadPixels.

The OpenGL ES 2 renderer does not check the target texture format when using SDL_RenderReadPixels and just always uses ABGR8888. This can result in swapped or wrong colors.

The attached patch adds a check and selects the target texture format, if a texture is set as the target.
Comment 1 Sam Lantinga 2016-10-01 18:39:30 UTC
Fixed, thanks!
I went ahead and applied the same patch to the OpenGL and OpenGL ES paths.
https://hg.libsdl.org/SDL/rev/ef00f5640e86