Trying out OpenGL on Raspberry Pi 3

It was announced in February 2016 that OpenGL drivers were being tested for the Raspberry PI allowing full 3D hardware graphics and a lot more Linux software to run on the RPi. Along with the release of the more powerful Raspberry Pi 3 I thought I will try out some existing OpenGL Games and software.

Since the Raspberry PI was released in 2012 it has only had basic graphics driver support via the OpenGL ES drivers but many games and programs that require 3D hardware accelerated graphics use the full OpenGL drivers. Both the Raspberry Pi 2 and 3 use quad core cpu's and have 1GB of memory allowing them to be more usable with OpenGL. At the time of writing the drivers are still in beta testing but I thought I would try a few games and programs out from the Raspbian package list and see how they perform on the new Raspberry Pi 3.

 

Activating OpenGL on the Raspberry Pi 3

To use the OpenGL drivers you will need the latest version of the Raspbian operating system. This can either be downloaded from the Raspberry Pi foundation using the Noobs SD card installer or if you are running Raspbian Jessie you can upgrade your current installation to bring it up to date.

Noobs or the latest Raspbian image can be downloaded from here

To update and existing copy of Raspbian Jessie enter the following commands into Terminal:

sudo apt-get updatesudo apt-get upgrade

 

I would recommend you use a clean installation of Noobs while trying out OpenGL software as it allows you to easily edit the Config.txt file and deactivate the drivers if your display goes blank. Just put a # infront of the entry for dtoverlay=vc4-kms-v3d

By default the OpenGL drivers are switched off as they are in testing and can cause problems with the graphics of the desktop and possibly use of the camera.

Before you activate the drivers install the graphics librarys with the command

sudo apt-get install mesa-utils

Once installed I run the glxgears program from Terminal. This shows 3 gears moving but the colours were flashing. The display shows they were running at 38 frames per second.

To activate the OpenGL drivers you need to run raspi-config from a terminal window as this option is not available in the version in the menu.

  • Enter the comand: sudo raspi-config
  • Select 7 Advance Options
  • A6 GL Drivers

You can now choose between

  • GL (Full KMS) Desktop Drivers
  • GL (Fake KMS) Desktop Driver
  • Legacy - Non-GL Driver

KMS refers to Kernel Mode-Setting,which should make the driver more efficient with better error handling, but I seem to have better compatibility with the Fake driver. The Legacy option will revert the Raspberry Pi's back to the standard graphics driver mode.

Select a driver and then OK.

You will also want to increase the memory split to at least 256mb. So choose Advance Options again and then Memory Split and enter 256 in the box and then OK.

OK then Finish and Reboot.

As the drivers are still in development there may still be a few odd things happen such as the screen going black for a second or two intermittently and having to login when the desktop loads.

Once the Desktop loaded I went into Terminal and run the glxgears program. If you get 3 gears running without the colours flickering then OpenGL is working. The display says it was running at 60 frames per second.

 

 Testing OpenGL Software

I have picked out a few games and one program that use OpenGL for my initial test on a Raspberry Pi 3, but I plan to try more. These were:

  • Stellarium - an Astronomy program
  • NeverBall - a puzzle game
  • NeverPutt - mini Golf game
  • glTron - Tron style Cycle game
  • OpenArea - first person shooter game
  • Super Tux Kart - a Mario Kart style game
  • Frets on Fire - a Guitar Hero style game

 Stellarium

Stellarium raspberryPi3

Stellarium loads and scrolls nicely and is responsive. With an earlier version of the OpenGL drivers the text was corrupt but using the Fake KMS driver the screen is responsive and the text is fine. There are still a few odd things that has happend such as the sky going white when zooming into some objects and the scripts in the configuration section not working properly but on the whole the program is usable and responsive.

 NeverBall

Neverball raspberryPi3

NeverBall works well and at full speed, it's not the most graphics intensive game by a long way but is an enjoyable puzzle game.

If you get barriers moving about or the floor disappear then make sure Vsync is on in the graphics settings.

This game dosn't work without the OpenGL drivers active.

NeverPutt

NeverPutt raspberryPi3

NeverPutt is from the same developer as NeverBall, which im sure you guessed. This also works well and is smooth and responsive. My testing was put on hold at this point as my kids took over the Raspberry Pi 3 and played this for more than an hour. So I can say no issues here.

It does still work without the OpenGL drivers active but is unplayably slow at only a few frames per second.

glTron

glTron raspberryPi3

Again another game with simple graphics, based on the Tron Cycles. This also works well at full speed. it has a fps counter and I was getting 60-70 fps. Again the kids took over and I had to put testing on hold again.

Without the OpenGL drivers active the game still works but is also unplayably slow.

OpenArena

OpenArena raspberryPi3

With the kids sent off to bed I tried OpenArea. This is a first person shooter so a bit more graphics intensive. In full screen HD graphics it runs at about 14 frames per second on level 1 so not very playable but the graphics were rendered well. When set to run in a window of about a quarter of the screen it was quite playable and the FPS counter was around 70 FPS on average skipping between 50 fps and 90fps depending on how much action was on the screen. The opponents seemed to glide about rather than run but I think that is more the game. I didn't spend a whole lot of time setting this game up but if you can get a good balance with the game setup I think it would be playable though I suspect when too much is going on in later levels or online games then the frame rate will get low. Running in demo mode with more action it runs at about 30 - 40 fps.

Without the OpenGL drivers active: The menu screens work but slowly and the game crashes when the game should start.


Super Tux Kart

This didn't work. The title screen came up but as soon as you try to select a menu option the whole screen froze.

Frets on Fire

FretsOnFire raspberryPi3

Frets on Fire is like Gutiar Hero and runs well at full speed but again has simple graphics.

Without the OpenGL driver active the title screen works but the game crashed before it started.

 

Video of Open Arena, glTron and NeverBall running on the Raspberry Pi 3

More to come....

There are plenty more games and programs to try, I had picked out some more graphical games but they were a tad large at over gigabyte to install, so I will need to make some space before I can try those out. For these simple games, as an initial test, the Raspberry Pi 3 and the OpenGL drivers work well and is a promising start. The Pi dosn't always boot with the drivers active and I had a few crashes, as expected in there current state, but once they are stable it shows that software that is available on desktop machines with a lot more power will be useable on the Raspberry Pi 3.

Update: I have tried to run the graphical Real Time Strategy game 0AD, which is over 1gb big. It loaded ok the menus seemed to work ok but the game wouldn't start and then crashed, causing the screen to go black. Probably needs more memory.

 

 

 

Google

Additional information