Screen "garbage" when resizing sdlwindow on raspberry pi 4 with opengl driver enabled

Hi,

I make my window resizeable and i let SDL scale the output window. On my raspberry pi 4 with the opengl driver enabled and when using hardware acceleration, when i resize my window, the previous graphics of how my game was running before remain visible instead of showing black. I also tested software renderer but i can not reproduce it using the software renderer. Is there anyway to “clear” those faulty graphics after i have resized my window?

I’m talking about this

I make my window resizeable and i let SDL scale the output window. On my raspberry pi 4 with the opengl driver enabled and when using hardware acceleration, when i resize my window, the previous graphics of how my game was running before remain visible instead of showing black. I also tested software renderer but i can not reproduce it using the software renderer. Is there anyway to “clear” those faulty graphics ?

Are you clearing the screen on each frame? Unless you’re drawing over
every pixel, you’re supposed to do something like:

SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);

Hi thanks, that seemed to be the problem indeed. I did have to create an extra buffer now as i was using some fading between screens but by clearing the main screen to black the fading was not working anymore so i blit to extra buffer and that extra buffer to screen. Seems to work fine now