Skip to content
SaeHie Park edited this page Mar 26, 2019 · 7 revisions

GPU

OpenCL

Common Graphics for x86 PC and RPi2/3

For both Ubuntu with/without X11 and Raspberry Pi 2/3 on Ubuntu

Purpose

Simple windowless graphics to display Image(texture)/2D/3D

SDL

Source

Build on x86_64

Prerequisite

sudo apt-get install xorg-dev

Build and Install

mkdir -p ~/v/build/sdl2
cd ~/v/build/sdl2

$HOME/v/src/SDL2-2.0.5/configure \
--prefix=$HOME/v/local \
--disable-pulseaudio --disable-esd --disable-video-mir \
--disable-video-wayland --disable-video-opengl \
--with-x

make -j3
make install

Add to environment

# add $HOME/v/local/bin to PATH
# add $HOME/v/local/lib to LD_LIBRARY_PATH

Build on RPi2/3

cd SDL
mkdir -p build.arm
cd build.arm

../configure --prefix=/opt/rpi \
--disable-pulseaudio --disable-esd --disable-video-mir \
--disable-video-wayland --disable-video-x11 --without-x \
--disable-video-opengl --disable-video-vulkan \
--enable-video-opengles --enable-video-opengles1 \
--enable-video-opengles2 \
--enable-video-rpi \
--enable-video-directfb

make -j1
sudo make install

Changing video resolution

SDL RPi2/3 resolution is fixed to video mode that is set on boot time. One can change /boot/config.txt to change the resolution but not prefereable. One can change at runtime while boot with full HD resolution.

$ tvservice -e "DMT 16"
$ sleep 1

To restore,

$ tvservice -p
$ sleep 1
$ fbset -depth 24 && fbset -depth 32

When tvservice -p is called, don't know the reason, screen is blank and doesn't show anything. fbset -depth 24 && fbset -depth 32 is a hack to make things visible.

SDL Tutorial

SDL_ttf

Build on RPi2/3

mkdir -p build.arm
cd build.arm
../configure --prefix=/opt/rpi
make
sudo make install
Clone this wiki locally