Working with Shaders on the Raspberry Pi 4

You need the following Scenome® modules to complete all exercises involving the Raspberry Pi 4: Scenome® Platform Binaries, Scenome® Video Module, Scenome® Raspberry Pi 4 Export Module

The Scenome® Shader application allows you to develop shaders and export them to Raspberry Pi 4. In this series, you'll learn to connect the Scenome® Shader application to your Raspberry Pi® 4 video camera so that you can see the video stream running live in the Scenome® Shader application. Then you'll learn how to implement a shader for performing edge detection. Finally, you'll learn how to export and compile a complete C++ application that uses your shader code to process video directly on your Raspberry Pi® 4 device. The process is as follows:

  1. Run the Scenome® Shader application on the Windows® platform to write, debug, and test GLSL code
  2. Export the developed GLSL code from the Scenome® Shader application as a series of files that can be copied to your Raspberry Pi® 4 device
  3. On the Raspberry Pi® 4, compile these GLSL files into a finished application.

Here are the three main tasks we need to accomplish before we can write shaders and export them to your Raspberry Pi® 4:

You'll need the following in order to complete these tasks:

Item Description
Raspberry Pi® 4 deviceA Raspberry Pi® 4 capable of running GLSL 300 shaders, or an equivalent device.
Raspberry Pi® 4-compatible video cameraYou'll need a camera to capture video.
RealVNC®The ability to connect to and control your Raspberry Pi® 4 from your Windows development machine.
Terminal AccessThe ability to access the terminal (command prompt) on your Raspberry Pi® 4.
Video Stream AddressThe RTSP address for the Raspberry Pi® 4 video camera. For example: rtsp://
VLC® or similarThe ability to display video output by your Raspberry Pi® 4 video camera and GPU.
File TransferThe ability to manually copy the exported files (C++ source code, GLSL source code, config files, make files) from your PC to the correct location on your Raspberry Pi® 4 device. (e.g., Samba, as discussed below).

There are many ways to accomplish the above tasks. In this series of exercises, we provide you with one approach which we have found to be simple and easy to understand. Feel free to use your preferred approach to accomplish these same tasks. We will be using the following third party tools in these exercises:

Item Description
Real VNC® You can download and install Real VNC® on your Windows development machine and you can use it to simplify interfacing with and controlling your Raspberry Pi® 4. RealVNC can enable you to connect directly to your Raspberry Pi® 4 across the Internet or simply across your local network. This exercise assumes you will connect to your Raspberry Pi 4 over your local network. Please refer to the following links for reference information on this: VNC Connect and Raspberry Pi 4 and Real VNC Raspberry Pi Setup.
Samba You can install Samba on your Raspberry Pi® and use it to copy files from your PC to your Raspberry Pi® 4.
VLC You can download and install VLC on your Windows development machine and use it to display images and streamed video from your Raspberry Pi® 4.