Here is the third chapter of the NeHe OpenGL lessons ported to make use of the Qt toolkit.
Third chapter: waving texture, display lists and a lot of fonts
The third chapter starts off with a cool looking waving flag effect. After that you will learn about display lists. The last three lessons focus on different ways of displaying fonts. It is worth noting that rendering basic text at a chosen location, or translated into the OpenGL scene is extremely easy in Qt/OpenGL thanks to QGLWidget::renderText(). For other basic text effects (such as rotated, skewed or otherwise transformed text) you could also use QPainter directly on a QGLWidget. We won’t be doing this in our examples, but I just wanted to point out that it is possible.
I should also note that I have used an extra library in lesson 14 to display the 3D text. Qt itself is not able to display 3D text and doing this in a cross-platform way yourself would be rather hard. That’s why I have used the FTGL library for this. FTGL is a very easy to use cross-platform library with the sole purpose of rendering (3D) text in OpenGL.
Videos and source code
This video shows the waving flag effect (lesson 11)
This video shows the effect of using display lists (lesson 12)
This video shows rotated 3D text (lesson 14)
You can download the Qt 4 source code for this chapter here.
PS: You can expect chapter 4 in a few days