Working version with QGLViewer window run from separate thread. Hangs until window is closed.