├── CONTRIBUTING.md ├── Demo_Programs_TILE.png ├── LICENCE.md ├── README.md ├── cover.png ├── en ├── images │ ├── .keep │ ├── banner.png │ ├── bbb.jpg │ ├── cover.jpg │ ├── mandelbrot.jpg │ ├── teapot.jpg │ └── terminal.png ├── meta.yml ├── resources │ └── .keep ├── step_1.md ├── step_10.md ├── step_11.md ├── step_2.md ├── step_3.md ├── step_4.md ├── step_5.md ├── step_6.md ├── step_7.md ├── step_8.md └── step_9.md ├── images ├── bbb.jpg ├── cover.jpg ├── mandelbrot.jpg ├── teapot.jpg └── terminal.png ├── learn.md ├── meta.yml ├── overview.md └── worksheet.md /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | All contributions are assumed to be licensed under the same license as the source, i.e. CC BY-SA. This license must remain in all derivatives of this work. 4 | 5 | ## Issues 6 | 7 | If you find a mistake, bug or other problem, please [open an issue](https://github.com/raspberrypilearning/demo-programs/issues) in this repository. 8 | 9 | ## Pull Requests 10 | 11 | If you fix a mistake, bug or problem or have something to contribute, please create a pull request for each modification. Please consider grouping modifications sensibly, i.e. don't bundle typo fixes in the same pull request as code changes, instead file them separately. 12 | 13 | Please note that sometimes things are done for pedagogical reasons so changes which make sense from a software engineering perspective (reducing duplication or making use of more advanced programming language features) may not be suitable to maintain the intended educational value. 14 | 15 | ## Derivatives 16 | 17 | The licence must remain in all derivatives of this work. 18 | 19 | ## Licence 20 | 21 | Unless otherwise specified, everything in this repository is covered by the following licence: 22 | 23 | ![Creative Commons License](http://i.creativecommons.org/l/by-sa/4.0/88x31.png) 24 | 25 | ***Demo Programs*** by the [Raspberry Pi Foundation](http://raspberrypi.org) is licenced under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). 26 | 27 | Based on a work at https://github.com/raspberrypilearning/demo-programs 28 | -------------------------------------------------------------------------------- /Demo_Programs_TILE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/Demo_Programs_TILE.png -------------------------------------------------------------------------------- /LICENCE.md: -------------------------------------------------------------------------------- 1 | # Licence 2 | 3 | Unless otherwise specified, everything in this repository is covered by the following licence: 4 | 5 | ![Creative Commons License](http://i.creativecommons.org/l/by-sa/4.0/88x31.png) 6 | 7 | ***Demo Programs*** by the [Raspberry Pi Foundation](http://raspberrypi.org) is licenced under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). 8 | 9 | Based on a work at https://github.com/raspberrypilearning/demo-programs 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi demo programs 2 | 3 | **This is an archived resource.** The repo will remain available but the resource will no longer be maintained or updated. Some or all parts of the resource may no longer work. To see our latest resources, please visit [raspberrypi.org](http://www.raspberrypi.org). 4 | 5 | How to run the hello_pi demo programs on Raspbian 6 | 7 | ![image](./images/cover.jpg "Raspberry Pi") 8 | 9 | ## So you’ve got a Raspberry Pi. Now what? 10 | 11 | How about running some demo programs that showcase what the Pi is capable of? Awesome graphics, anyone? 12 | Raspbian comes with a range of demo programs which you can just compile and run. They range from simple "hello world" text output, to full 1080p HD video playback, 3D spinning teapots, and real-time animating fractal patterns. 13 | These are a great way to get a feel for what the Pi can do, and to gain some familiarity with navigating around the system and running programs at the command line. 14 | 15 | ## Requirements 16 | 17 | As well as a Raspberry Pi with an SD card loaded with Raspbian, you'll also need: 18 | 19 | ### Hardware 20 | 21 | - Raspberry Pi 22 | - Micro USB power adapter 23 | - An SD Card with Raspbian already set up through NOOBS 24 | - USB keyboard 25 | - HDMI cable 26 | - A monitor or TV 27 | 28 | ### Time 29 | 30 | - 10 minutes 31 | 32 | ## Steps 33 | 34 | 1. Setting Up your Pi 35 | 1. Oh no! A command line interface! 36 | 1. Hello world 37 | 1. Hello video 38 | 1. Hello triangle 39 | 1. Hello triangle 2 40 | 1. Hello teapot 41 | 1. Hello audio 42 | 1. Other demos 43 | 44 | ## Worksheet 45 | 46 | - [The worksheet](worksheet.md) 47 | 48 | ## Licence 49 | 50 | Unless otherwise specified, everything in this repository is covered by the following licence: 51 | 52 | ![Creative Commons License](http://i.creativecommons.org/l/by-sa/4.0/88x31.png) 53 | 54 | ***Demo Programs*** by the [Raspberry Pi Foundation](http://raspberrypi.org) is licenced under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). 55 | 56 | Based on a work at https://github.com/raspberrypilearning/demo-programs 57 | -------------------------------------------------------------------------------- /cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/cover.png -------------------------------------------------------------------------------- /en/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/en/images/.keep -------------------------------------------------------------------------------- /en/images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/en/images/banner.png -------------------------------------------------------------------------------- /en/images/bbb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/en/images/bbb.jpg -------------------------------------------------------------------------------- /en/images/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/en/images/cover.jpg -------------------------------------------------------------------------------- /en/images/mandelbrot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/en/images/mandelbrot.jpg -------------------------------------------------------------------------------- /en/images/teapot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/en/images/teapot.jpg -------------------------------------------------------------------------------- /en/images/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/en/images/terminal.png -------------------------------------------------------------------------------- /en/meta.yml: -------------------------------------------------------------------------------- 1 | --- 2 | title: Demo Programs 3 | hero_image: images/banner.png 4 | description: Learn how to run the Raspberry Pi demo programs 5 | original_url: https://raspberrypi.org/learning/demo-programs 6 | theme: violet 7 | duration: 2 8 | listed: false 9 | ingredient: false 10 | copyedit: true 11 | curriculum: 1, design-0, programming-1, phys-comp-0, manufacture-0, community-0 12 | interests: '' 13 | technologies: '' 14 | hardware: '' 15 | software: '' 16 | site_areas: projects 17 | vesion: 4 18 | last_tested: 2017-01-01 19 | steps: 20 | - title: Introduction 21 | - title: What you will need 22 | completion: engaged 23 | - title: Demo Programs 24 | - title: Oh no! A command line interface! 25 | - title: Hello world 26 | - title: Hello video 27 | - title: Hello triangle 28 | - title: Hello triangle 2 29 | - title: Hello teapot 30 | completion: internal 31 | - title: Hello audio 32 | - title: What next? 33 | -------------------------------------------------------------------------------- /en/resources/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/en/resources/.keep -------------------------------------------------------------------------------- /en/step_1.md: -------------------------------------------------------------------------------- 1 | ## What you will make 2 | How about running some demo programs that showcase what the Pi is capable of? Awesome graphics, anyone? 3 | 4 | Raspbian comes with a range of demo programs which you can just compile and run. They range from simple *hello world* text output, to full 1080p HD video playback, 3D spinning teapots and real-time animating fractal patterns. 5 | These are a great way to get a feel for what the Pi can do, and to gain some familiarity with navigating around the system and running programs at the command line. 6 | ## What you will learn 7 | By following this resource you will learn: 8 | 9 | - How to use the command line interface 10 | - How to navigate the file system 11 | - How to compile code 12 | - How to run code 13 | 14 | This resource covers elements from the following strands of the [Raspberry Pi Digital Making Curriculum](https://www.raspberrypi.org/curriculum/): 15 | 16 | 17 | -------------------------------------------------------------------------------- /en/step_10.md: -------------------------------------------------------------------------------- 1 | ## Hello audio 2 | 3 | This demo just demonstrates audio output. It plays a sine wave, which makes a kind of WOO WOO WOO sound. 4 | 5 | ```bash 6 | cd .. 7 | cd hello_audio 8 | ls 9 | ``` 10 | 11 | Notice the green `.bin` file? Run it. Getting the hang of this now? 12 | 13 | `./hello_audio.bin` 14 | 15 | This will play the sound over the headphone jack on the Pi. If you’re using a HDMI monitor, you can make it output over HDMI by adding a `1` to the command. 16 | 17 | `./hello_audio.bin 1` 18 | 19 | The demo will run forever until you quit. To exit the demo press `Ctrl – C`. 20 | 21 | -------------------------------------------------------------------------------- /en/step_11.md: -------------------------------------------------------------------------------- 1 | ## What next? 2 | 3 | - By now you should be getting the hang of navigating up into the parent `hello_pi` folder (using `cd ..`) and then down into one of the demo folders (using `cd hello_something`). 4 | - Try some of the other demos on your own. The `hello_videocube` one is a good place to start. 5 | 6 | -------------------------------------------------------------------------------- /en/step_2.md: -------------------------------------------------------------------------------- 1 | ## What you will need 2 | 3 | - Just a Raspberry Pi with the latest [Raspbian](https://www.raspberrypi.org/downloads/) installed. 4 | -------------------------------------------------------------------------------- /en/step_3.md: -------------------------------------------------------------------------------- 1 | ## Demo Programs 2 | 3 | Raspbian comes with a range of demo programs which you can just compile and run. They range from simple *hello world* text output, to full 1080p HD video playback, 3D spinning teapots and real-time animating fractal patterns. These are a great way to get a feel for what the Pi can do, and to gain some familiarity with navigating around the system and running programs at the command line. 4 | 5 | -------------------------------------------------------------------------------- /en/step_4.md: -------------------------------------------------------------------------------- 1 | ## Oh no! A command line interface! 2 | 3 | Boot up your Raspberry Pi and open a terminal window: 4 | 5 | ![Terminal](images/terminal.png) 6 | 7 | `pi@raspberrypi ~ $ _` 8 | 9 | The text above is the command prompt. Try not to be afraid of it! A CLI (command line interface) is actually a very quick and efficient way to use a computer. 10 | 11 | To start, enter the command below to navigate to the `hello_pi` folder where all the demos are stored. **TIP**: You can use the `TAB` key for auto-complete as you enter commands. 12 | 13 | `cd /opt/vc/src/hello_pi` 14 | 15 | The command prompt should now look like this. The blue part shows where you are in the file system of the Pi. 16 | 17 | `pi@raspberrypi /opt/vc/src/hello_pi $ _` 18 | 19 | If you enter `ls` and press `enter`, you’ll see a list of folders. There is one for each demo. Before you can run them though, they must be compiled. Don’t worry if you don’t understand why you need to do this; just go along with it for now, and we'll learn more about it later on. 20 | 21 | There is a small shell script supplied in the `hello_pi` folder called `rebuild.sh`, which will do the compile for you. Enter the following command to run it. Ignore the gobbledygook for now! 22 | 23 | `./rebuild.sh` 24 | 25 | A lot of text will scroll up the screen now, but for this exercise you can ignore it. It is just the output of the compiler as it works through the demo code. Wait for the command prompt to return before you continue. 26 | 27 | Now we’re ready to run some demos. 28 | 29 | -------------------------------------------------------------------------------- /en/step_5.md: -------------------------------------------------------------------------------- 1 | ## Hello world 2 | 3 | First, let's do a quick test that will ensure the previous compilation step worked correctly. This rather boring program will only display the text `Hello world!`, but if it works correctly then we know all the other demos should work too. 4 | 5 | Enter the following commands to go inside the `hello_world` folder and list the files. 6 | 7 | ```bash 8 | cd hello_world 9 | ls 10 | ``` 11 | 12 | You’ll notice the `.bin` file is shown in green. This is because it is an executable file. This means this is the file we run to launch the program. 13 | 14 | Use the following command to run the demo. You need the `./` to specify the current directory, otherwise the Linux system folders will be searched for the filename you type. 15 | 16 | `./hello_world.bin` 17 | 18 | -------------------------------------------------------------------------------- /en/step_6.md: -------------------------------------------------------------------------------- 1 | ## Hello video 2 | 3 | This will play a 15 second long, full HD 1080p video clip with no sound. The intention here is to demonstrate video decode and playback capability. You’ll see that it's very smooth! 4 | 5 | ![image](images/bbb.jpg "Big Buck Bunny") 6 | 7 | Enter the following commands to navigate to the `hello_video` folder and list the files. 8 | 9 | ```bash 10 | cd .. 11 | cd hello_video 12 | ls 13 | ``` 14 | 15 | You’ll notice the `.bin` file again. This demo needs to be told what video clip to play when we run it though, so this must be the `test.h264` file (h264 is a type of video codec). 16 | 17 | You'll need the `./` to specify the current directory again. 18 | 19 | `./hello_video.bin test.h264` 20 | 21 | -------------------------------------------------------------------------------- /en/step_7.md: -------------------------------------------------------------------------------- 1 | ## Hello triangle 2 | 3 | This displays a spinning cube with different images on each side. This is intended to demonstrate Open GL ES rendering (an open-source programming library for doing 3D graphics). 4 | 5 | Enter the following commands to navigate to the `hello_triangle` folder and list its contents. 6 | 7 | ```bash 8 | cd .. 9 | cd hello_triangle 10 | ls 11 | ``` 12 | 13 | You’ll again see that one of the files is green. This is the executable file. This demo doesn’t need any video input files like the previous one, so you can just go ahead and run the `.bin` file. 14 | 15 | `./hello_triangle.bin` 16 | 17 | The demo will run forever until you decide to quit. To exit the demo press `Ctrl – C`. 18 | 19 | -------------------------------------------------------------------------------- /en/step_8.md: -------------------------------------------------------------------------------- 1 | ## Hello triangle 2 2 | 3 | This one displays two superimposed fractals, one on top of the other. You can move the mouse to change the shape of the fractal in real time. This is also intended to demonstrate Open GL ES rendering. Some of you may recognise the Mandelbrot fractal. 4 | 5 | ![image](images/mandelbrot.jpg "Mandelbrot") 6 | 7 | ```bash 8 | cd .. 9 | cd hello_triangle2 10 | ls 11 | ``` 12 | 13 | Notice the green `.bin` file? Okay, run it! 14 | 15 | `./hello_triangle2.bin` 16 | 17 | Now move the mouse around, and you’ll see the fractal changing. See if you can get it to form a perfect circle. It’s a little tricky, but it can be done. To exit the demo press `Ctrl – C`. 18 | 19 | -------------------------------------------------------------------------------- /en/step_9.md: -------------------------------------------------------------------------------- 1 | ## Hello teapot 2 | 3 | This displays a spinning teapot with the video clip from `hello_video` texture-mapped onto its surface. Impressive! You may recognise the teapot model if you’re familiar with a piece of software called Blender. This demonstrates Open GL ES rendering and video decode/playback at the same time. 4 | 5 | ![image](images/teapot.jpg "Tea Pot") 6 | 7 | ```bash 8 | cd .. 9 | cd hello_teapot 10 | ls 11 | ``` 12 | 13 | Notice the green `.bin` file? Okay, run it! 14 | 15 | `./hello_teapot.bin` 16 | 17 | You may receive the following error when you try to run this demo: 18 | 19 | ``` 20 | Note: ensure you have sufficient gpu_mem configured 21 | eglCreateImageKHR: failed to create image for buffer 0x1 target 12465 error 0x300c 22 | eglCreateImageKHR failed. 23 | ``` 24 | 25 | Don’t worry though: if you see this error, you just need to alter one configuration setting to make it work. 26 | 27 | The error means the GPU (graphics processing unit) does not have enough memory to run the demo. It’s the GPU that does all the heavy lifting when drawing 3D graphics to the screen (a bit like the graphics card in a gaming PC). The Raspberry Pi shares its memory/RAM between the CPU and GPU, and by default is configured to only give 64 MB of RAM to the GPU. If we increase this to 128, that should fix the problem. 28 | 29 | To do that, you'll need to enter the following command: 30 | 31 | `sudo raspi-config` 32 | 33 | This will open up a menu on a blue background. Perform the following actions: 34 | 35 | - Go to Advanced Options. 36 | - Go to Memory Split. 37 | - Delete `64` and enter `128` instead. Press `enter`. 38 | - Go down to Finish. 39 | - Click Yes to reboot. 40 | 41 | After you have logged back in, enter the following command to get back to the `hello_teapot` demo: 42 | 43 | `cd /opt/vc/src/hello_pi/hello_teapot` 44 | 45 | Now try and run it again, and you should find it will work. 46 | 47 | `./hello_teapot.bin` 48 | 49 | The demo will run forever until you quit. To exit the demo press `Ctrl – C`. 50 | 51 | -------------------------------------------------------------------------------- /images/bbb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/images/bbb.jpg -------------------------------------------------------------------------------- /images/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/images/cover.jpg -------------------------------------------------------------------------------- /images/mandelbrot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/images/mandelbrot.jpg -------------------------------------------------------------------------------- /images/teapot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/images/teapot.jpg -------------------------------------------------------------------------------- /images/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/demo-programs/99a6fd4e8e8027fa7c232d463b3a5b4780725827/images/terminal.png -------------------------------------------------------------------------------- /learn.md: -------------------------------------------------------------------------------- 1 | By following this resource you will learn: 2 | 3 | - How to use the command line interface 4 | - How to navigate the file system 5 | - How to compile code 6 | - How to run code 7 | 8 | This resource covers elements from the following strands of the [Raspberry Pi Digital Making Curriculum](https://www.raspberrypi.org/curriculum/): 9 | 10 | -------------------------------------------------------------------------------- /meta.yml: -------------------------------------------------------------------------------- 1 | title: Demo Programs 2 | category: learn 3 | -------------------------------------------------------------------------------- /overview.md: -------------------------------------------------------------------------------- 1 | How about running some demo programs that showcase what the Pi is capable of? Awesome graphics, anyone? 2 | 3 | Raspbian comes with a range of demo programs which you can just compile and run. They range from simple *hello world* text output, to full 1080p HD video playback, 3D spinning teapots and real-time animating fractal patterns. 4 | These are a great way to get a feel for what the Pi can do, and to gain some familiarity with navigating around the system and running programs at the command line. -------------------------------------------------------------------------------- /worksheet.md: -------------------------------------------------------------------------------- 1 | # Demo Programs 2 | 3 | Raspbian comes with a range of demo programs which you can just compile and run. They range from simple *hello world* text output, to full 1080p HD video playback, 3D spinning teapots and real-time animating fractal patterns. These are a great way to get a feel for what the Pi can do, and to gain some familiarity with navigating around the system and running programs at the command line. 4 | 5 | ## Oh no! A command line interface! 6 | 7 | Boot up your Raspberry Pi and open a terminal window: 8 | 9 | ![Terminal](images/terminal.png) 10 | 11 | `pi@raspberrypi ~ $ _` 12 | 13 | The text above is the command prompt. Try not to be afraid of it! A CLI (command line interface) is actually a very quick and efficient way to use a computer. 14 | 15 | To start, enter the command below to navigate to the `hello_pi` folder where all the demos are stored. **TIP**: You can use the `TAB` key for auto-complete as you enter commands. 16 | 17 | `cd /opt/vc/src/hello_pi` 18 | 19 | The command prompt should now look like this. The blue part shows where you are in the file system of the Pi. 20 | 21 | `pi@raspberrypi /opt/vc/src/hello_pi $ _` 22 | 23 | If you enter `ls` and press `enter`, you’ll see a list of folders. There is one for each demo. Before you can run them though, they must be compiled. Don’t worry if you don’t understand why you need to do this; just go along with it for now, and we'll learn more about it later on. 24 | 25 | There is a small shell script supplied in the `hello_pi` folder called `rebuild.sh`, which will do the compile for you. Enter the following command to run it. Ignore the gobbledygook for now! 26 | 27 | `./rebuild.sh` 28 | 29 | A lot of text will scroll up the screen now, but for this exercise you can ignore it. It is just the output of the compiler as it works through the demo code. Wait for the command prompt to return before you continue. 30 | 31 | Now we’re ready to run some demos. 32 | 33 | ## Hello world 34 | 35 | First, let's do a quick test that will ensure the previous compilation step worked correctly. This rather boring program will only display the text `Hello world!`, but if it works correctly then we know all the other demos should work too. 36 | 37 | Enter the following commands to go inside the `hello_world` folder and list the files. 38 | 39 | ``` 40 | cd hello_world 41 | ls 42 | ``` 43 | 44 | You’ll notice the `.bin` file is shown in green. This is because it is an executable file. This means this is the file we run to launch the program. 45 | 46 | Use the following command to run the demo. You need the `./` to specify the current directory, otherwise the Linux system folders will be searched for the filename you type. 47 | 48 | `./hello_world.bin` 49 | 50 | ## Hello video 51 | 52 | This will play a 15 second long, full HD 1080p video clip with no sound. The intention here is to demonstrate video decode and playback capability. You’ll see that it's very smooth! 53 | 54 | ![image](images/bbb.jpg "Big Buck Bunny") 55 | 56 | Enter the following commands to navigate to the `hello_video` folder and list the files. 57 | 58 | ``` 59 | cd .. 60 | cd hello_video 61 | ls 62 | ``` 63 | 64 | You’ll notice the `.bin` file again. This demo needs to be told what video clip to play when we run it though, so this must be the `test.h264` file (h264 is a type of video codec). 65 | 66 | You'll need the `./` to specify the current directory again. 67 | 68 | `./hello_video.bin test.h264` 69 | 70 | ## Hello triangle 71 | 72 | This displays a spinning cube with different images on each side. This is intended to demonstrate Open GL ES rendering (an open-source programming library for doing 3D graphics). 73 | 74 | Enter the following commands to navigate to the `hello_triangle` folder and list its contents. 75 | 76 | ``` 77 | cd .. 78 | cd hello_triangle 79 | ls 80 | ``` 81 | 82 | You’ll again see that one of the files is green. This is the executable file. This demo doesn’t need any video input files like the previous one, so you can just go ahead and run the `.bin` file. 83 | 84 | `./hello_triangle.bin` 85 | 86 | The demo will run forever until you decide to quit. To exit the demo press `Ctrl – C`. 87 | 88 | ## Hello triangle 2 89 | 90 | This one displays two superimposed fractals, one on top of the other. You can move the mouse to change the shape of the fractal in real time. This is also intended to demonstrate Open GL ES rendering. Some of you may recognise the Mandelbrot fractal. 91 | 92 | ![image](images/mandelbrot.jpg "Mandelbrot") 93 | 94 | ``` 95 | cd .. 96 | cd hello_triangle2 97 | ls 98 | ``` 99 | 100 | Notice the green `.bin` file? Okay, run it! 101 | 102 | `./hello_triangle2.bin` 103 | 104 | Now move the mouse around, and you’ll see the fractal changing. See if you can get it to form a perfect circle. It’s a little tricky, but it can be done. To exit the demo press `Ctrl – C`. 105 | 106 | ## Hello teapot 107 | 108 | This displays a spinning teapot with the video clip from `hello_video` texture-mapped onto its surface. Impressive! You may recognise the teapot model if you’re familiar with a piece of software called Blender. This demonstrates Open GL ES rendering and video decode/playback at the same time. 109 | 110 | ![image](images/teapot.jpg "Tea Pot") 111 | 112 | ``` 113 | cd .. 114 | cd hello_teapot 115 | ls 116 | ``` 117 | 118 | Notice the green `.bin` file? Okay, run it! 119 | 120 | `./hello_teapot.bin` 121 | 122 | You may receive the following error when you try to run this demo: 123 | 124 | ``` 125 | Note: ensure you have sufficient gpu_mem configured 126 | eglCreateImageKHR: failed to create image for buffer 0x1 target 12465 error 0x300c 127 | eglCreateImageKHR failed. 128 | ``` 129 | 130 | Don’t worry though: if you see this error, you just need to alter one configuration setting to make it work. 131 | 132 | The error means the GPU (graphics processing unit) does not have enough memory to run the demo. It’s the GPU that does all the heavy lifting when drawing 3D graphics to the screen (a bit like the graphics card in a gaming PC). The Raspberry Pi shares its memory/RAM between the CPU and GPU, and by default is configured to only give 64 MB of RAM to the GPU. If we increase this to 128, that should fix the problem. 133 | 134 | To do that, you'll need to enter the following command: 135 | 136 | `sudo raspi-config` 137 | 138 | This will open up a menu on a blue background. Perform the following actions: 139 | 140 | - Go to Advanced Options. 141 | - Go to Memory Split. 142 | - Delete `64` and enter `128` instead. Press `enter`. 143 | - Go down to Finish. 144 | - Click Yes to reboot. 145 | 146 | After you have logged back in, enter the following command to get back to the `hello_teapot` demo: 147 | 148 | `cd /opt/vc/src/hello_pi/hello_teapot` 149 | 150 | Now try and run it again, and you should find it will work. 151 | 152 | `./hello_teapot.bin` 153 | 154 | The demo will run forever until you quit. To exit the demo press `Ctrl – C`. 155 | 156 | ## Hello audio 157 | 158 | This demo just demonstrates audio output. It plays a sine wave, which makes a kind of WOO WOO WOO sound. 159 | 160 | ``` 161 | cd .. 162 | cd hello_audio 163 | ls 164 | ``` 165 | 166 | Notice the green `.bin` file? Run it. Getting the hang of this now? 167 | 168 | `./hello_audio.bin` 169 | 170 | This will play the sound over the headphone jack on the Pi. If you’re using a HDMI monitor, you can make it output over HDMI by adding a `1` to the command. 171 | 172 | `./hello_audio.bin 1` 173 | 174 | The demo will run forever until you quit. To exit the demo press `Ctrl – C`. 175 | 176 | ## What next? 177 | 178 | - By now you should be getting the hang of navigating up into the parent `hello_pi` folder (using `cd ..`) and then down into one of the demo folders (using `cd hello_something`). 179 | - Try some of the other demos on your own. The `hello_videocube` one is a good place to start. 180 | --------------------------------------------------------------------------------