# Raspberry Pi 3 Notes

### Requirements

- Raspbian Jessie or later
- CMake 3.0+

#### CMake

To install CMake:

    sudo apt-get install cmake

### Cinder Dependencies

    sudo apt-get install libxcursor-dev \
    libgles2-mesa-dev \
    zlib1g-dev \
    libfontconfig1-dev \
    libmpg123-dev \
    libsndfile1 \
    libsndfile1-dev \
    libpulse-dev \
    libasound2-dev \
    libcurl4-gnutls-dev \
    libgstreamer1.0-dev \
    libgstreamer-plugins-bad1.0-dev \
    libgstreamer-plugins-base1.0-dev \
    gstreamer1.0-libav \
    gstreamer1.0-alsa \
    gstreamer1.0-pulseaudio \
    gstreamer1.0-plugins-bad

# Building Cinder

### Fetching and Building Cinder

    git clone --recursive https://github.com/cinder/Cinder.git
    cd Cinder
    mkdir build && cd build
    cmake .. -DCINDER_TARGET_GL=es2-rpi
    make -j 3

NOTE: Attempting to build Cinder with more than 3 jobs (specified with the `-j 3` parameter) will likely cause a hard crash due to GCC memory requirements.

#### Clang

Cinder can also be used with the version of Clang (v3.5.0) packaged for Raspbian Jessie. Install it using `apt-get`:

    sudo apt-get install clang

To set Clang as the default compiler, select `/usr/bin/clang++` when prompted by this command:

    sudo update-alternatives --config c++

# Building and Running BasicApp

### Building

    cd samples/BasicApp/proj/cmake
    mkdir build && cd build
    cmake .. -DCINDER_TARGET_GL=es2-rpi
    make

### Running

Starting from `samples/BasicApp/proj/cmake/build`:

    ./Debug/BasicApp

### Exiting

Hit the `Esc` key to exit the BasicApp. Cinder for Linux on the Raspberry Pi 3 currently has `Esc` hardcoded to exit an application. Otherwise it's non-trivial to return to the OS. A future version will offer a more graceful way to handle this.

# Troubleshooting

### Audio

#### Starting the pulsedeamon

Raspbian ships with Pulse Audio installed, however you must start the `pulsedeamon` before you can use audio in your application. Do that by running the following:

    pulseaudio -D

#### No Output Using 3.5mm headphone jack

Try the following, it will force output to the 3.5mm jack (more information here):

    sudo amixer cset numid=3 1