Showing posts with label experiment. Show all posts
Showing posts with label experiment. Show all posts

Monday, September 19, 2011

SwipEout - Python + OpenGL ES 2.0 on the N950 (and N900!)

Last weekend I've been toying around with Open GL ES 2.0 on the N950 after finding a nice Xlib-based Python example on the web for the N900. I modified the code a bit, replaced the Xlib code with a QGLWidget from QtOpenGL (via PySide), which makes the setup a lot easier and (apart from API differences of GL ES 2.0 and Desktop GL) allows me to test the prototype on my normal computer as well.

After I got the hang of it, I decided to come up with some fancy 90s-style hover racing game (only texturing, no lighting), or at least parts of it - right now, the small hovercraft just runs around the track and you can shift it left and right via the touchscreen and switching between normal and bird's view by pressing any hardware key.

As for the GL ES bindings (this is the interesting/useful part to developers who want to access the GL ES 2.0 API from Python), I put together a naive header-to-ctypes binding generator for the GL ES 2.0 API which you can run on "gl2.h" from the Qt SDK's Madde sysroot (too lazy to search for a working binding generator that surely exists somewhere out there already) - or just grab the generated "gles2.py" from the SwipEout source tarball. The result? Video it yourself.


You can grab the source code and miscellaneous files from the SwipEout website. The code was tested on the N900 and N950, you only need Python, PIL (python-imaging), PySide and the Open GL ES 2.0 libraries (libGLESv2.so) installed. Removing the PIL dependency and replacing it with Qt-based texture loading is left as an exercise for the reader. Enjoy :)

Sunday, August 29, 2010

Playing around with MeeGo Touch

While the MeeGo Touch Python Bindings are still not packaged and released, I though I'd give the C++ library a try and have a look through the class hierarchy. After getting the basic "Hello World" app running, I decided to create an application that can load the list of subscriptions from gPodder's SQLite database:

This view uses MContentItem, which already provides an icon and two lines of text - correctly styled and ready to go. Menu and toolbar items are MAction objects that can either appear everywhere or only at specific places (e.g. only in the toolbar). The great thing is that this all works on your Desktop in a normal window, so testing applications on your computer will be much easier with MeeGo Touch than it is with Hildon (which does not really run without its own hildon-desktop session in Xephyr).

The screenshot above is from the prototype written in C++, and shows how a gPodder MeeGo UI could look like. The MeeGo Touch UI of gPodder will be implemented in Python once the bindings are ready - the framework seems to be fun to work with so far. If you would like to play around with it yourself: MeeGo Touch is available from the MeeGo PPA of Ville M. Vainio if you are on Ubuntu and don't want to build it yourself.

Monday, May 3, 2010

N810 + pyDance + USB Host Mode + Dance Mat

Most of the cool hacks these days are done using the N900 for obvious reasons. For this little experiment, I needed the good old N810 with its USB Host Mode (as the N900 doesn't support USB Host Mode right now) to get things going. An alternative approach would be to use BlueMaemo running on a N8x0 (with a USB device attached) acting as Bluetooth HID device for the N900 and running pyDance from the N900 on the big screen with its TV-out.

Here's a walkthrough video on how it's done:

I hope to post the packages needed to get this going shortly. Attila was kind enough to package the joydev.ko kernel module for Diablo, so we're just missing pygame/SDL_mixer with OGG support in the repositories. It's not Stepmania, but it works just as well with only minimal code changes.