| | | |

Writing Clutter apps on BeagleBone Black using Python


Clutter is a great SDK for writing hardware accelerated GUI apps for embedded devices. It can run on X and Wayland, but it can also use the framebuffer directly and bypass the overhead of a display manager completely, ideal for embedded devices.

I have spent the last few weeks working on getting Clutter to run on BeagleBone Black and a working recipe is now available. That means that if you have your BeagleBone up and running with Angstrom, you should be able to write “opkg install libclutter-1.0-dev” and everything will magically install, which is the point of a packet distribution system. Right now, there are a few more steps. Look below.

3D integration

One of the great things about Clutter is the tight integration with OpenGL ES 2. This makes it easy to make a 2D/3D app since all actors drawing is handled by the Cogl backend.

Since the back end of Clutter is handled by Cogl, extending the Clutter library by adding custom actors is (normally) fairly straight forward. I say normally since it works fine when writing in C. If you want to use python, the the problem becomes slightly more difficult.. Since the bindings are auto-generated with Gobject instrospection, the loading of vertex buffers have not been optimized and takes a big toll on the main CPU. A workaround is to use Mash. So far We’ve only managed to load a model and not yet gotten the shading to work, so the model that can be seen in the picture above is fairly uninspiring.. But there are still two weeks left until Maker Faire Oslo!

There is also a great library for adding widgets called Mx. An Angstrom package is now available for that as well. Here is a picture showing the widgets: https://wiki.gnome.org/Projects/Vala/MxSample?action=AttachFile&do=get&target=mx-widget-factory.png

When making a GUI, a handy tool is the ClutterScript. This allows the structure to be defined in a JSON file. There is also an option for styling layout components using CSS.

Getting started with Clutter on BeagleBone Black

The bad news about Clutter is that there are almost no up to date examples, especially if you want to use one of the languages it has bindings for (C++, Python, Vala). This might be because the main page, clutter-project.org is in the process of being moved. The API reference manuals are well made though. I’ve made an effort in trying to correct that, so the thing wiki has been updated with a few hello world examples: http://wiki.thing-printer.com/index.php?title=Clutter_on_BeagleBone#Hello_world_using_Clutter_on_BeagleBone_Black_-_Python_code

Installation currently requires adding a package feed from Thing Printer (this website), upgrading the kernel to 3.12 (which is still fairly unstable) and installing a custom version of the SGX SDK. I’ve tried to upload most of the work that has been done to different repositories, in case anyone wants to fix something that is broken.

All the stuff you should need is gathered on the thing wiki: http://wiki.thing-printer.com/index.php?title=Clutter_on_BeagleBone

Similar Posts

One Comment

Leave a Reply