Sdl2 not working without x11 mode in odroid


Even though the chunk of code compiles & runs perfectly in my ubuntu 18.04v GUI mode in odroid XU4 but when I try to run the same code in TERMINAL mode( alt + ctrl + F2) it is showing this


“Failed to initialize SDLSDL: No available video device”

Any Help??


You’re trying to initialize the video portion of SDL where there is no video capabilities. You can either remove SDL_INIT_VIDEO, or you’ll need to change SDL_INIT_EVERYTHING to the initialization flags but without SDL_INIT_VIDEO.


well there is , SDL is working fine in the GUI mode , but as soon as I run the code in terminal mode , it gives error. If my system didn’t had the video displaying capabilities , why it would have run perfectly in the first scenario itself ??

why would i do that, I am using SDL for that specific purpose only, to render onto the screen.


Terminal mode does not have a GUI at all. When you’re using a desktop manager, (Cinnamon, MATE, KDE, GNOME, Unity, etc.), either X11, mir, or wayland is running in the background allowing graphics to be used. When you switch to the terminal, you’re leaving the graphics portion completely. You’re basically saying, “Why can’t I watch a video on my book?” Since you’re only using SDL for video, you don’t need it then; and can ignore the error, but you won’t be able to use any SDL calls to any of the video routines either.


so you are implying through terminal mode by anyhow i wont be able to make calls to sdl_init_video


Some programs can still use the frame buffer in the terminal, without any X or Wayland.


Indeed there is, did not know that. I thought the framebuffer was just another renderer like wayland or mir. A bit of work to get it on the screen though: How can I customize a full-screen console background (TTY)?

Definitely beyond me for now. Good luck though.


From looking at this thread, it seems that only SDL 1.2 supports that:


Found what I was looking for: Is anyone using DirectFB?
It’ll probably work the same as any normal program, but will work in the terminal. You’ll need to reconfigure your cmake to enable the framebuffer option, VIDEO_DIRECTFB, then recompile your SDL2 library.


do i need to install DIRECTFB , before enabling the the option??


after using directfb its the new error !!


yup , now it works by compiling SDL2 with KMSDRM support !!!