OpenGL ES 2.0. Hello Triangle+Quad+Rotation+Color Blending


The picoFlamingo Team proudly presents its first BeagleBoard 3D graphics test. It doesn't look too much, but what we were trying to do was to produce the minimal set of dependencies to produce an OpenGL ES 2.0 application. First of all, a short video and then, let's go to the details.

As you can see is the typical Hello Triangle demo. We added also a QUAD, some colors, rotation and color blending... just to make it a bit different.

The first interesting thing is that the demo was written using the Imagination Technologies PowerVR SDK to develop it in our desktop computer and later cross-compile it to run it in the Beagle.

The second interesting thing is that we tried to remove most of the dependencies like the PVRShell or the OpenEmbedded environment. Both of them are really good things, but we were trying to figure out what is the minimal set of "stuff" for a 3D application.

Compiling OpenGL ES application in the host computer

In order to compile our OpenGL ES application in our host computer we just need to link the application against the libraries provided by the Imagination Technologies SDK. To download the SDK you need to register in their web site.

These libraries can be found in the subdirectory Builds/OGLES2/LinuxPC. There you will find two more directories, one with the libraries and another one with the include. That's all you need to compile your own Hello Triangle demo. That and a Makefile similar to this:

INCLUDE_DIR=-I. -I./include -I./${ITSDK_DIR}/Include
LIBS=-lEGL -lGLESv2 -lm



        ${CC} -o $@ $<  ${INCLUDE_DIR} ${LIB_DIR} ${LIBS}

Basically, you just need to add the right path to the compiler options to find the includes and libraries. For running the application you will also need to update your LD_LIBRARY_PATH to include the libraries directory (there are other alternatives but this is the most straight-forward way).

With this set-up we can compile our demo in our host machine and run it. This is how it will look like.

picoFlamingo OpenGL ES Test 1

Cross-Compiling OpenGL ES application for the Beagle

Now is time to cross-compile our test for running it in the Beagle. For the Beagle version we used the RAW interface instead of the X11, so initialization code is a bit different... but if you go for the X11 interface, the same code should work.

In order to cross-compile we also need the includes and libraries but now for the Beagle. We can reuse the includes, but we need to get the right libraries. These libraries come with the Texas Instruments OMAP35x Graphics SDK that you can download from the TI site (check this link for more information).

Once you have installed the SDK, all the libraries you need are under gfx_XX directory, where XX can be rel or dbg, depending if you want to use the debug or release version of the libraries. Following the same approach described above we can just use this directory for compiling our application.

In that directory you will find a lot of libraries. The minimal set of these libraries you need for a simple application like this Hello triangle example are:

Yes, we need two extra libraries. So, we copied them to a different directory to be sure that we only used that set and then we made some minor modifications to our Makefile, that now will look like this:

INCLUDE_DIR=-I. -I./include -I./${OUR_FILES}/include
LIB_DIR=-L./${OUR_FILES}/libs -Wl,-rpath=./${OUR_FILES}/libs
LIBS=-lEGL -lGLESv2 -lm




In this Makefile, the variable OUR_FILES points to a subdirectory where we have put the includes and libraries we need. Header files are stored in the include subdir, and libraries in the libs subdir. The main difference is the use of the -rpath linker option. In principle you can put the whole list of libraries in the LIBS variable as an alternative, but we didn't test that... If you try that option, please, let us know :).

Now we can compile our simple demo with the following command:

make CC=arm-none-linux-gnueabi-gcc

Running the demo in the Beagle

In order to run the demo in the BeagleBoard, two steps are required.

1. Copy the executable to the board using the method you prefer.
2. Install the 3D acceleration packages as described here

The picoFlamingo Team