From 71aafdb23f66009b0f9886f6f8e462431f555f80 Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Mon, 26 Dec 2022 19:22:00 -0500 Subject: [PATCH] Add sdl2 --- SDL2 on Rpi without X11.html | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 SDL2 on Rpi without X11.html diff --git a/SDL2 on Rpi without X11.html b/SDL2 on Rpi without X11.html new file mode 100644 index 0000000..0e26ef4 --- /dev/null +++ b/SDL2 on Rpi without X11.html @@ -0,0 +1,34 @@ +
+
+

If you want to do graphical applications with SDL2 on a rapsberry pi +without the overhead of X11, you will need to compile SDL2 yourself. I'll +assume you are running raspian.

+ +

Install required libraries to build

+ +
sudo apt-get install libdrm-dev libgdm-dev
+ +

Next download a SDL2 source tarball. They can be found here. +Next, change to the directory of the unzipped tarball and run the following.

+ +
./configure --enable-video=kmsdrm + make -j4 + sudo make install +
+ +

To check if the library was compiled sucessfully, compile this +piece of code. You should see the screen flashing, as well as your desired +graphics driver on stdout. To compile,

+ +
g++ ./test_prog.cpp `pkg-config --cflags --libs sdl2` +
+ +

You can change the driver used via raspi-config if opengl es is not +desired.

+ +

I hope this helped someone, happy embedded programming!

+ +
+