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 4026 - SDL_RenderClear() with transparency doesn't work
Summary: SDL_RenderClear() with transparency doesn't work
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.7
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-06 11:45 UTC by Ellie
Modified: 2018-09-12 08:51 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ellie 2018-01-06 11:45:32 UTC
According to the documentation, SDL_RenderClear() will "clear the current rendering target with the drawing color". Therefore, the following code should intuitively clear the render target with transparency:

        SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
        SDL_RenderClear(renderer);

However, the result in my tests is a black color. This user seems to have identified some relation to blend modes:

 https://forums.libsdl.org/viewtopic.php?p=39909

Since SDL_RenderClear() is not intended for blending on top and the documentation makes no mention of blend modes but clearly suggests that the color is replaced unconditionally with the specified render color, I think this is a bug that should be fixed.
Comment 1 Ellie 2018-01-06 12:05:23 UTC
Oops, I was running it on a completely invalid memory address and for some divine reason it didn't crash (but it also didn't work, unsurprisingly). Sorry :-)