SDL_RenderClear(3)
β¨ SDL_RenderClear(3) β¨
okay so bestie, we're diving into the SDL3 FUNCTIONS section of the manual and this one is genuinely so useful it's giving main character energy π
it's called SDL_RenderClear and yes, we're gonna clear the whole entire rendering target with the drawing color. slay.
πΈ NAME πΈ
SDL_RenderClear β clear the current rendering target with the drawing color. that's it, that's the vibe π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_render.h>
bool SDL_RenderClear(SDL_Renderer *renderer);
π DESCRIPTION π
so what does it actually do? it clears the entire rendering target, no cap. and when I say entire, I mean it literally ignores the viewport and the clip rectangle β those boundaries? not invited to this party π the whole target gets wiped, periodt.
β οΈ also important, bestie: clearing will set/fill all the pixels of the rendering target to the current renderer draw color. so make sure you invoke SDL_SetRenderDrawColor() when needed, otherwise you're gonna be out here clearing into whatever color was already set and being confused. we've all been there. it's giving tragic. don't do that to yourself π
π FUNCTION PARAMETERS π
rendererβ the rendering context. that's your renderer bestie, the one you already made. hand it over π
β RETURN VALUE β
returns true on success or false on failure. and if it fails?? call SDL_GetError() for more info β she will tell you what went wrong, i promise π«Ά
π₯ THREAD SAFETY π₯
this function should only be called on the main thread. yes, only. no side-quest threads on this one, bestie. main character thread only, no exceptions π
π AVAILABILITY π
this function is available since SDL 3.2.0. iconic. historic. we love to see it β¨
π§ SEE ALSO π§
SDL_SetRenderDrawColor(3)β go set your color before you clear, you'll thank me later π
and that's the whole page bestie, you ate that π this little manual moment comes to you from Simple Directmedia Layer (the SDL girlies π«Ά), SDL 3.4.18, filed under SDL_RenderClear(3). go forth and clear your render target, i'm obsessed with you ππ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms