如何在调用 SDL_RenderPresent 后清除渲染器?

how to clear renderer after calling SDL_RenderPresent?

我为渲染器创建纹理,在调用 SDL_RenderPresent 几秒钟后,我想在屏幕上清除它? 我使用 SDL_RenderClear,但没有用。

            SDL_RenderPresent(renderer);
            SDL_Delay(5000);
            SDL_RenderClear(renderer);

SDL_RenderPresent()更新画面,SDL_RenderClear()调用后需要再次调用

摘自the remarks section:

SDL's rendering functions operate on a backbuffer; that is, calling a rendering function such as SDL_RenderDrawLine() does not directly put a line on the screen, but rather updates the backbuffer. As such, you compose your entire scene and present the composed backbuffer to the screen as a complete picture.

您所做的 SDL_RenderClear() 调用正在该后台缓冲区上运行。