O'Reilly logo

Learning Python with Raspberry Pi by Ben Everard, Alex Bradbury

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6

Creating Graphics with OpenGL

THERE'S NO DENYING that 3D graphics look cool. The sense of depth they create uses more than 2D graphics, and allows you as a programmer to create richer worlds. However, this comes at a cost. Firstly, they take much more computing power to render than 2D graphics, and secondly they are significantly more complex to program.

You often find graphics cards (sometimes known as a Graphics Processing Units, or GPUs) on normal PCs. These provide additional processing power that the computer can use to render complex 3D scenes. Basically, these add a lot of processors that can handle floating-point maths very quickly. A quick look at a Raspberry Pi will tell you that there's no space to add a GPU because it doesn't have the same layout as a PC. Instead of a motherboard with a processor, memory, and expansion slots, everything is enclosed on a System on a Chip (SoC). This is the largest square chip in the middle of the Pi. If you look carefully at it from the side, you'll see that it's made up of two layers. The top layer is the RAM, and the bottom layer does the processing.

The bottom layer isn't just a CPU (Central Processing Unit), though. In fact, the CPU is only a small part of it. It also contains a GPU that's far more powerful than the CPU. When you run normal programs, the GPU sits idly by while the CPU does all the work. When working with 3D graphics, though, the CPU can't handle it by itself, so you have to off-load some of the work to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required