SDL2 app works correctly on Windows, but not in Linux

I have this code: (second snippet)
on Windows it’s working correctly (shows a video), but in Lubuntu 14.04 and Debian 8.x.x, I just getting empty window as in video:

Any ideas where is problem?
Thank you

When I started with SDL2 I had exactly the same problem: my code worked in Windows but not in Linux. In my case it turned out to be because I had taken liberties with threading: I was calling SDL rendering functions from multiple threads. It should never have worked at all really, but Windows seemed to be more tolerant of my mistake.

I don’t know whether your problem stems from a similar cause, but I do notice that you are (for example) calling SDL_RenderPresent from a VLC callback, and that could well be being made from a different thread.


Hello Richard,

I moved rendering into another thread, now it’s working, but only if I have in renderer SDL_RENDERER_SOFTWARE, else I have black screen. Any ideas?


I don’t really know. If you un-comment the SDL_SetRenderDrawColor() statement do you get a green background, or is it still black? Do you have to use the BGR565 pixel format or can you try a different one?


1 Like

The libvlc example uses the callback from libvlc to update the texture from a non-gui thread.
You need to use some kind of message between the threads.