[Qt-interest] GLUT to Qt
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Mon Apr 20 14:38:36 CEST 2009
John McClurkin wrote on Monday, April 20, 2009 1:59 PM:
> ... . However, it is not
> necessary to call updateGL(). You can just call update() on the
> QGLWidget.
That's correct - there /is/ a tiny little difference between update() and updateGL() though, which might be important to the OP.
Generally a call to update() "marks" the corresponding widget for an update *later on*, that is, it merely raises a flag and sais "Hey Qt, update this widget, whenever you think it is time to do so!". And eventually, when the Qt event queue finds some time, the widget is updated. The Qt event queue is so clever to "compress" several successive update() calls ("events"), so when the actual update takes place only one update is really done.
UpdateGL() however /immediatelly/ triggers an update of the widget: it makes the OpenGL context the current one for this widget and calls paintGL(). It only returns as soon as all the OpenGL commands in paingGL() have been executed (which on their turn are asynchronous as well, unless one calls explicitly glFlush() or so).
It is the equivalent of calling http://doc.trolltech.com/4.5/qwidget.html#repaint.
In general calling update() is the preferred method, since the "responsiveness" of an application is then under control by the Qt event queue.
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list