My program worked well on Ubuntu 18.04 with SDL2. On Ubuntu 20.04 I installed SDL2 with ‘sudo apt install libsdl2-dev’ which is version 2.0.10 - window is completely black (sound is still coming out though). Tried build/install from sources and SDL_VERSION shows 2.0.13 (for both compiled and linked) - same black screen.
I use SDL2 this way:
if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ) < 0 ) { cerr << "Failed to SDL_Init()" << endl; return -1; } SDL_Window * sdlWindow = SDL_CreateWindow( "SDL window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1280, 720, 0 ); SDL_Renderer * sdlRenderer = SDL_CreateRenderer( sdlWindow, -1, 0 ); const auto sdlTexture = SDL_CreateTexture( sdlRenderer, SDL_PIXELFORMAT_BGR24, SDL_TEXTUREACCESS_STREAMING, 1280, 720 ); ... and then when I have bitmap data:
SDL_UpdateTexture( sdlTexture, NULL, bitmap_data.data, bitmap_data.linesize );
SDL_RenderClear( sdlRenderer );
SDL_RenderCopy( sdlRenderer, sdlTexture, NULL, NULL );
SDL_RenderPresent( sdlRenderer );
What could be the reason? Thanks in advance.