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

Summary: GLES2_RenderReadPixels doesn't use target texture format
Product: SDL Reporter: Simon Hug <chli.hug>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: Patch that fixes the incorrect format selection in GLES2_RenderReadPixels.

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