GLUT for C++ and OpenGL ES

did you ever try to use GLUT with C++? Do you remember the pain of having to make you member function static, so they can be used as a callback? Maybe you also want to create a OpenGL ES2 context if you develop for mobile devices. But although the latest freeglut supports OpenGL3 contexts, you are still out of luck using GLUT here. But there is rescue:

#include <QGLWidget>

class View : public QGLWidget {
public:
 View();  // glutInit
protected:
 void initializeGL();
 void paintGL(); // glutDisplayFunc
 void resizeGL(int width, int height); // glutReshapeFunc
 void keyPressEvent(QKeyEvent *event); // glutKeyboardFunc
};

and thats it. Works with OpenGL2 and OpenGL ES2 and integrates nicely with the Object Oriented approach. As Qt is LGPL today you can also use it in closed source projects and as you see, you can easily migrate from GLUT without changing all your code 🙂

YouAmp 0.6 has grown

After several betas the final release of YouAmp 0.6 is almost there. You can find the current versions in the launchpad PPA for Ubuntu and in maemo-extras for N8x0.

YouAmp DesktopYouAmp Maemo

the new features are:

  • Playlists
  • Automatic Cover Download
  • Adding Files from anywhere, not just the music library (just drag and drop in Desktop version)
  • you can pay for YouAmp now

I would like to emphasise the last feature: make me a millionaire! No seriously – if you like YouAmp consider a small donation > 0,30€ (otherwise everything goes to paypal) which will help developing the program in my free-time. 😉

As I did not get into the Developers programme for the N900, I also accept unused discount codes – in case you would like to see YouAmp on the N900.

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.