lunes, 17 de diciembre de 2012

First OpenGL experiments with the Pandaboard


Hello!

It's been a long time since my last udpate. But hopefully i'm going to post more  frequently from now on since i've got more toys this chritsmas. One of this is my new pandaboard, ES revB2. I bought it because it was already time for me to learn OpenGL ES more deeply, and since I'm not very fan of android(or any non native platform) i chose this beacuse i can program it with direct acces to the hardware.

First thing i tried was the Linaro Ubuntu distribution. I was very impressed after watching this board booting Ubuntu, and not a 'lite' version, it was the complete desktop environment with the same applications and tools that I use in my PC, wifi and bluetooth. It didn't have the same speed of course, but everything was runing almost flawlessly, almost.... I managed to compile a program from the Imagination technologies OpenGLESSDK, the 'Hello World' and, although functional, i realized that the rendering was being done in software, through MESA. 

OK..., after that i tried GeexBox, XBMC for the pandaboard. It worked very very well and finally i saw the pandaboard doing a very good job ta rendering the UI and 1080p video decoding.

After that, now I'm trying wth the Ubuntu image available from pandabaord.org . I tested the previous executable and the program ran correctly creating an OpenGL ES 2 context with hardware acceleration. So, my cross compilation method is correct and there maybe something that i missed configuring the linaro image. Anyway, I think that from now I'll make the rest of my experiments with this distribution.

For cross compilation I'm using the linaro toolchain. It is working correctly, i only had to copy some '.so's from the pandaboard and now I'm compiling everything in my Ubuntu desktop, with Netbeans. Here is an example of hos to write a qmake file to build programs for the pandaboard:

TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += \
main.cpp
#El SDK de PowerVR
INCLUDEPATH += /opt/Imagination/PowerVR/GraphicsSDK/SDK_3.0/Builds
INCLUDEPATH += /opt/Imagination/PowerVR/GraphicsSDK/SDK_3.0/Builds/OGLES2/Include/
QMAKE_LIBDIR += /opt/Imagination/PowerVR/GraphicsSDK/SDK_3.0/Builds/OGLES2/Linux_armv7/Lib
QMAKE_LIBDIR += /home/rhuertas/PandaBoard/TargetLibs
LIBS += -lEGL
LIBS += -lGLESv2
LIBS += -lX11
LIBS += -lxcb
LIBS += -lXau
LIBS += -lXdmcp
#El SDK de LinaroQMAKE_CXX = arm-linux-gnueabihf-g++
QMAKE_CC = arm-linux-gnueabihf-gcc
QMAKE_LINK = arm-linux-gnueabihf-g++
In the 'TargetLibs' directory are the following '.so' files, extracted from the image: libX11.so.6.3.0, libXau.so.6.0.0, libxcb.so.1.1.0, libXdmcp.so.6.0.0. Also there are the softlinks to remove any version specific linkage(ej. libX11.so)

Even more awesome is that, since OpenGL 4.1, you have full OpenGL ES available in your PC, so you can develop and test your programs in your PC for functionality and correcteness of your shaders, and then just test how well it performs on the pandaboard. The setup is easy, I'm attaching a sample project made with netbeans to show you how you can use this ideas to quickly develop OpenGL ES apps from your PC.


An finally, some photos of the toy:


My setup, a bluetooth keyboard, an USB hub and a mouse. Wifi for networking. video output to my TV, because I don't want to buy another monitor

The pandaboard running an OpenGL application with hardware acceleration enabled



The same program from above running on my desktop. i just need to select the current
configuration in the Netbeans project to generate each target.(ej: DebugPC, ReleasePC, DebugPanda, ReleasePanda...)

My main aim is to develop an open gaming-enertainment platform that I can use with the pandaboard, beagle boards o raspberry pis. Since now Ubuntu si being ported the those wonderful android phones and tablets, i hope soon we can get rid of thet virtual machine and have more applications working directly with the OS, like in iOS and Windows Phone platforms.

More ideas and help is welcome.
Happy coding!