OpenGL on the N900

some people already got enthusiastic because they heard that the N900 – nokias latest Linux phone supports OpenGL. Playing games like Frets On Fire on your phone as soon as you got one was a common expectation. But this will not be possible – at least not as easy as you might think.

OpenGL does not always mean OpenGL. There is OpenGL1, OpenGL2, OpenGL3, OpenGL ES1 and last but not least OpenGL ES2. While all contain OpenGL in the name and are somewhat similiar they are not compatible with each other. Basically only GL2 is compatible with GL1 programs. As soon as the deprecated stuff will be removed from GL3, GL2 programs wont run any more. Generally GLES is also not compatible with GL – but programs written in GL2 are very similar to GLES1 and programs written in GL3 are likewise similar to GLES2. So porting between this two pairs is easily possible. The problem is that Quake3 was written with GL1 and the N900 only supports GLES2. This means that basically the whole renderer of the game has to be rewritten.

Another problem is that FretsOnFire uses SDL1.2 for input/ output handling and context creation(through pygame). But SDL1.2 uses GL1 for context creation so you cant use that. Luckily there is SDL1.3 which also supports GLES2 but it is not available on the N900 yet.

So in order to get an existing game running on the N900 one would have to rewrite the engine using the GLES2/GL3 model and replace any libraries  (SDL1.2, GLUT) with direct calls to EGL for context creation and Xlib to get the window . The port of Quake3 to Maemo shows that this is possible – but it will usually take more time than a simple recompile.