OpenGL on Raspberry

My target is to have a “Kiosk” app running on Raspberry on headless Linux.
But I read in the forum that juce needs a desktop environment to display an UI.
Somewhere else I read that OpenGl may could make a desktop environment obsolete…
Since the battle field OpenGL is absolutely new to me, maybe someone can provide some
basic information. What I would like to know is:

  • Is OpenGl the key for my approach?
  • Can I turn my “standard” application into an OpenGL app without hassle?
  • Is there any tutorial (hopefully using juce) or more detailed information
    how to transform my application into OpenGL (if this is possible at all)?

Thank you in advance

This is exactly what I want and I asked here:

You do not need a desktop environment to run JUCE but you do need X11. No matter what type of graphics you are using, you need some kind of display backend (even for OpenGL or OpenGL ES) to handle user input (mouse, keyboard, etc.) and events. X11 is the most popular display backend and used by all major linux desktops but you don’t need to install a desktop environment to be able to use X11. There are other display backends such as wayland. Wayland is up-and-coming and a lot more light-weight than X11 but not supported by JUCE yet.

OpenGL is just a graphics accelerator. If your graphics are too slow then you should consider using OpenGL. But you still need some kind of display backend to actually show the graphics and process the input. OpenGL ES does allow you to display graphics without running a display backend but you still need something that would handle events and user input.


As mentioned above, if your using JUCE you will need to run your app under X11. If your graphics are too slow, you can speed them up with OpenGL. This is very easy to do with JUCE. Simply attach an OpenGLContext to your top-level component.


It’s easy to test-run your JUCE app without a desktop environment:

  1. Most distributions will boot into a desktop environment (GNOME/KDE/XFCE/…) so you will need to kill the desktop session. SSH into your raspberry pi and kill the display manager:

    sudo /etc/init.d/lightdm stop

    You might be running a different display manager (for example mdm) so you may want to replace lightdm with something else.

  2. Then on a root shell start the X server:
    sudo bash

  3. On a different shell (ssh into your raspberry pi from a new terminal) type-in
    export DISPLAY=:0

1 Like

Hi Fabian,

thanks for your very useful information. Actually I don’t need OpenGL then because my graphics is running smooth so far. I just thought I could get around the headless issue but I don’t do according your reply.
I’ve tested you lines of code and it worked well without having the desktop started which also makes the Kiosk mode obsolete. Hopefully I can squeeze your code in a script to start things automatically.

Thanks again!