Showing posts with label opengl es. Show all posts
Showing posts with label opengl es. 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 :)

Saturday, April 3, 2010

Brain Party ported to the N900

Brain Party from Hudzilla Games has been released as open source for Linux some days ago. A thread on t.m.o suggested somebody port this over to Maemo. An afternoon of tinkering later (and with the help of Javispedro's SDL-GLES library), I've got the game to run on the N900 (see the patch for details on the changes - as you can see, the original source code is pretty clean, so porting was mostly straightforward after being told about SDL-GLES, fixing a parameter for glTexImage2D and doing some math to scale the game to the N900's screen and scale the input coordinates the same way). The package is currently in Extras-Devel, soon to be promoted to Extras-Testing. In the mean time, you can grab binary and source packages from this page (use apt-get -f install afterwards to satisfy dependencies).

Please test it and vote for it on the Maemo.org package page when it enters Extras-Testing (did you know that you can follow @maemoextras on Twitter to see packages entering Extras-Testing and Extras? Now you do..).

It's good to see developers porting their games to Linux and open sourcing them, which makes learning from their code and porting the games to other platforms very easy. If you like the game, please support the developers by purchasing Brain Party for the iPhone (you probably don't have an iPhone, so show the N900 game off to your freedom-hating friends and tell them that they should purchase the game for their iPhone/iPod touch on the App Store). The game is also available for Windows Mobile and Xbox 360.