Drawing shapesSDL 3.2

SDL_RenderClear

Fills the whole render target with the current draw colour. The first draw call of every frame.

Signature

bool SDL_RenderClear(SDL_Renderer *renderer);

How it works

After SDL_RenderPresent the back buffer's contents are undefined, so every frame starts with a clear. It covers the entire target, ignoring the viewport and the clip rectangle.

Parameters

rendererSDL_Renderer *

The renderer.

Return value

true on success, false on failure.

Example

example.cpp
1SDL_SetRenderDrawColor(renderer, 16, 18, 26, 255);
2SDL_RenderClear(renderer);
3drawWorld(renderer);
4SDL_RenderPresent(renderer);
Official SDL wiki