PDA

View Full Version : Qt OpenGL equivalent of glutIdleFunc()?



HappySmileMan
23rd July 2008, 20:43
I'm just learning OpenGL programming now, the tutorials in the guide use glut but I'm trying to do them with QGLWidget instead.

Does anyone know if there is an equivalent for glutIdleFunc() in QGLWidget? It sets a function that is called whenever the program is idle, used for animation in the example.

I was thinking I could set it up a signal and slot with a timer, but that could result in either gaps between the animations if the timer is too high, or weird behaviour if the timer is too low.

HappySmileMan
23rd July 2008, 22:53
Ok never mind, turns out setting the interval on a QTimer to 0 does exactly what I want, but I can't find out how to delete this thread.

ntp
23rd July 2008, 22:56
You need to use timers. Your slot for the timer callback will be the equivalent of the glutIdelFunc. If you set the timer interval to be 1, it will be continuously called. if you set it to 0, it will be called when all the events in the window system's event queue have been processed.