A question about SDL_RenderClear

As we all know, there’s Double Buffering,Which buffer does it clears?All of the two or something else?

My assumption is that it clears only the current ‘render target’. I use it to clear a texture which I have created, by firstly making it the render target:

 SDL_SetRenderTarget(renderer, myTexture);
 SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
 SDL_RenderClear(renderer);

I expect this to clear only myTexture, not any of the ‘buffers’. If I’m wrong I would certainly like to know.

2 Likes

Yeah, it just clears whatever you’re currently drawing to.

1 Like