| Summary: | SDL_RenderClear() with transparency doesn't work | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ellie <etc0de> |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | alain.Bonnefoy |
| Version: | 2.0.7 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
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 :-) |
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.