The box example This example program shows how to use OpenGL in Qt: Put your OpenGL code in a class inherited from QGLWidget. The resulting subclass may be used like any other Qt widget, with signals and slots, geometry management, etc..