By experimenting, we have found that adding a short delay(~100ms) at the very start(after SDL_CreateWindow) fixes the issue. This might mean that there iswas a conflict between the OS's Dekstop/Window Manager and SDL when lastthe latter renders too quickly. So, adding aA short delay tellsforces SDL to wait some time while OS's Dekstop/Window Manager handles the window's creation. Also, this
This might also be something related to OS's (D/E)M or itsthe compositor(i.e. compiz), which in our case KDE Plasma- compiz.
In other words, the changes:
...
// Create window
window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
SDL_Delay(100); // A short delay should be put here(if doesn't work try increasing delay)
if( window == NULL )
{
...
After thatWith these changes, athe white window opens successfully.
Already'Already wrote to the author of LazyFoo and hopefully he'll committhey will alter the tutorial.