zafena development

July 10, 2015

Processing 3 is running for the first time on a Raspberry Pi using Eric Anholt’s Mesa3D VC4 driver!

Video of the Processing 3 RGB cube demo running on the Raspberry Pi using Eric Anholt’s Mesa3D VC4 OpenGL 2 driver:

Thanks to the free software Mesa3d vc4 driver, the raspberry pi suddenly turned from a mobile opengl es 2 system into a “desktop” opengl 2 system.

Processing 3 is using JogAmp JOGL to tap into OpenGL hardware acceleration on the armv6 Raspberry Pi 1 and armv7 RaspberryPi 2 systems.

Hold on what is going on here, how can I setup the free software vc4 driver on my Raspberry Pi system?

This is a collaboration with Eric Anholt, anholt, and Gottfried Haider, gohai, to get Processing 3 running on the Raspberry Pi.

Eric Anholt has worked about a year to implement a full OpenGL 2 Mesa3D driver for use on the Raspberry Pi by using the Video Core 4, VC4, GPU.

Getting Eric Anholt’s Mesa3D VC4 driver running on a Raspberry Pi is easily done thanks to the work by gohai.
gohai started out roughly following Eric’s notes here:
And then put together a buildbot in Python, to produce system images for use on the Pi or Pi2.

Kernel, Mesa, XServer packages & dependencies are from git. System image produced using gohai’s buildbot

gohai publish daily builds using his bot at:

Myself I have contributed to fix corner-cases in JogAmp JOGL OpenGL initialization to get it all running.

What was the problem using the proprietary OpenGL ES vc4 driver on the Raspberry Pi system?

The OpenGL ES standard do not cover how the native window is initialized.
When you initialize opengl es then you must pass a platform specific EGLNativeWindowType, EGLNativePixmapType and EGLNativeDisplayType depending on the OS you use.

If you read the Khronos header for eglplatform.h you will notice that the EGLNativeWindowType is different for
Windows: typedef HWND EGLNativeWindowType;
Mac: typedef void *EGLNativeWindowType;
Android: typedef struct ANativeWindow* EGLNativeWindowType;
Unix X11: typedef Window EGLNativeWindowType;

Creating an on-screen EGL rendering surface requires you to to use the eglCreateWindowSurface function, which takes a EGLNativeWindowType parameter. On the Raspberry Pi, however this is implemented as a EGL_DISPMANX_WINDOW_T struct, which is defined in eglplatform.h as:

typedef struct {
int width; /* This is necessary because dispmanx elements are not queriable. */
int height;

As you can see RaspberryPi using the properitary binary drivers uses a Broadcom unique native window type that is incompatible with X11.
This is the reason why we cant use the Processing code as is to pass a Java AWT Unix X11 Window to initialize OpenGL ES, EGL will return an error that you have passed an incompatible structure to eglCreateWindowSurface.

When using Eric Anholt’s Mesa3D vc4 driver then EGL will expect a Unix X11 Window for its EGLNativeWindowType and this is why processing will work out of the box when Erics Mesa3D vc4 driver in use. Eric’s vc4 driver also implements OpenGL 2 that can be initialized using GLX. GLX allows you to run Processing with OpenGL acceleration across remote X11 network connections!

Xerxes Rånby


  1. Hi,

    I’ve recently spotted this post and this looks like great news!

    I’ve just tried the above but ran into an error:
    “symbol lookup error: ../path/to/processing_sketch/ undefined symbol: bcm_host_init”
    I simply burned the latest build bot image( to a card then downloaded and ran 20150710-1502-vc4-processing.tar.bz2

    Am I missing something ? Do I need to modify anything ?

    Thank you,

    Comment by George — July 13, 2015 @ 20:16

  2. @Jakub has added official Raspberry Pi support starting with Processing 3.0.1 ! I would suggest your to try using Pure data in combination with the 3.0.1 release.

    @George the error “undefined symbol: bcm_host_init” seen when using the Broadcom OpenGL ES 2 driver have been fixed and is part of the processing 3.0.1 release:

    Comment by xerxes — November 16, 2015 @ 18:54

  3. Hi, I am making quick project based on something old, no details right now. I just want to ask, as non expert but art student. Is it possible to help me run PureData GEM on Raspberry Pi 2? Every of these every time taking me so long time. Alternative was to use Processing connected with PD to run visuals, audio from PD. Processing still not working, but I need 3D/GL for GEM I hope. Thanks. Kitty

    Comment by Jakub — November 6, 2015 @ 15:30

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress