From d7bdc12cfd4a2c36be855745091aab9b0654001e Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 25 Jun 2022 12:32:31 +0200 Subject: [PATCH] Updated Working on Raspberry Pi (markdown) --- Working-on-Raspberry-Pi.md | 52 +++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/Working-on-Raspberry-Pi.md b/Working-on-Raspberry-Pi.md index d4e8ff6..f3b34dd 100644 --- a/Working-on-Raspberry-Pi.md +++ b/Working-on-Raspberry-Pi.md @@ -1,9 +1,10 @@ To build your raylib game for Raspberry Pi you just need to download raylib git repository (or get the current release from [here](https://github.com/raysan5/raylib/releases)). All required libraries come with the raylib, **no additional dependencies are required**. raylib also comes with ready-to-use makefiles to compile source code and examples. +**WARNING: `PLATFORM_RPI` is deprecated (only works with Raspbian Buster). Use `PLATFORM_DRM` for latest RPI OS Bullseye.** ### Supported Devices and OS -Official OS supported is [Raspberry Pi OS](https://www.raspberrypi.org/software/operating-systems/), but Raspbian Stretch and Raspbian Buster currently work too. Raspberry Pi OS Bullseye works (but only with `PLATFORM_DRM`, not `PLATFORM_RPI`). The following Raspberry Pi devices work with raylib: +raylib supports the following Raspberry Pi models: - Raspberry Pi Zero (all models) - Raspberry Pi 1 (all models) @@ -11,18 +12,23 @@ Official OS supported is [Raspberry Pi OS](https://www.raspberrypi.org/software/ - Raspberry Pi 3 (all models) - Raspberry Pi 4 (all models) -_NOTE: **Raspberry Pi 4** native mode compilation requires `PLATFORM_DRM` compilation flag instead of `PLATFORM_RPI`!_So does **Raspberry Pi 0-3 with Bullseye OS** +raylib supports the platforms/OSs, **desktop and native modes**: + + - `PLATFORM_DESKTOP`: [Raspberry Pi OS Bullseye](https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-32-bit) desktop mode + - `PLATFORM_DRM`: [Raspberry Pi OS Bullseye](https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-32-bit) native mode + - `PLATFORM_RPI`: [Rasberryy Pi OS (Legacy)](https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-legacy) (deprecated - based on Raspbian Buster) native mode + +_NOTE: RPI OS Bullseye is currently supported by **all** RPI models while RPI OS Legacy is only supported by RPI 0-3 models._ ### Supported OpenGL backends - - OpenGL ES 2.0 in **native mode** (no X11 required) - - OpenGL 1.1 on X11 desktop mode - - OpenGL 2.1 on X11 desktop mode - - (OpenGL 3.3 on X11 desktop mode ?) + - OpenGL ES 2.0 in **native mode** (no X11 required) (`PLATFORM_DRM` or `PLATFORM_RPI`) + - OpenGL 1.1 on X11 desktop mode (`PLATFORM_DESKTOP`) + - OpenGL 2.1 on X11 desktop mode (`PLATFORM_DESKTOP`) -By default, raylib is will compile for a classic X11-based Linux desktop, using the `OpenGL desktop drivers`. However it is also possible to compile in native mode not depending on any windowing system (no X11 required), accessing Broadcom Video driver directly and running programs from the virtual terminal. +By default, raylib should be compiled with `PLATFORM_DESKTOP` on classic X11-based Linux desktop environment, using the provided `OpenGL desktop drivers`. However, it is also possible to compile in native mode not depending on any windowing system (no X11 required). -OpenGL desktop mode requires the GL desktop driver and supposedly it only works for RPI 2 and higher, that limit is set for performance reasons... but, if required, GL desktop driver can be also enabled on RPI B/B+ or Zero, [just follow this guide](https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=166495) to enable it. +When compiling for **native mode**, `PLATFORM_DRM` or `PLATFORM_RPI` should be used, depending on the RPI OS version, check previous point for details. ### Compiling raylib source code @@ -30,30 +36,30 @@ Before you can use raylib in your project you will have to compile it, but this Just navigate to `raylib\src\` directory and run one of the following options depending on your needs: -1. To use OpenGL ES 2.0 in native mode (no X11): +**1. To compile on desktop mode (X11 window)** -On Raspberry Pi 0-3 using legacy versions of OS: -``` -make PLATFORM=PLATFORM_RPI -``` -On Rapsberry Pi 4 or Raspberry Pi 0-3 using Bullseye or newer OS: -``` -make PLATFORM=PLATFORM_DRM -``` -2. To use desktop OpenGL 1.1 or 2.1 (X11 window) ``` make PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_21 ``` -3. To use standard OpenGL 3.3 (X11 window) -``` -make -``` + NOTE: To use raylib on the Raspberry Pi desktop, you need to had previously installed all desktop window-dev system libraries, if you just downloaded [Raspberry Pi OS Desktop](https://www.raspberrypi.org/software/operating-systems/), maybe it comes with required libraries installed but if it complains on compilation, just make sure to install the following libraries: ``` sudo apt-get install --no-install-recommends raspberrypi-ui-mods lxterminal gvfs sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev libxrandr-dev libxi-dev libasound2-dev mesa-common-dev libgl1-mesa-dev ``` -To compile raylib in native mode on Raspberry Pi 4, you need the specific DRM libraries: + +**2. To compile in native mode (no X11)** + +On Raspberry Pi models 0-3 using RPI OS Legacy: +``` +make PLATFORM=PLATFORM_RPI +``` +On Rapsberry Pi 0-4 using RPI OS Bullseye or newer: +``` +make PLATFORM=PLATFORM_DRM +``` + +NOTE: To compile raylib in native mode on Raspberry Pi 4, you need the specific DRM libraries: ``` sudo apt-get install libdrm-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev ```