updateGL() should be at least as fast, if not faster than update() since it bypasses the QWidget paint system with clipping, region updating and what have you.
A quick dump of the call stack (on windows) shows that update() has the following calling order:
> gltest.exe!GLWidget::paintGL() Line 18 C++
QtOpenGLd4.
dll!QGLWidget::glDraw() Line
3111 C
++...
QtGuid4.
dll!QWidgetPrivate
::drawWidget(QPaintDevice * pdev
=0x0012feb8,
const QRegion & rgn
={...
},
const QPoint & offset
={...
},
int flags
=3) Line
1212 + 0xd bytes C
++ QtGuid4.
dll!qt_syncBackingStore
(QRegion rgn
={...
},
QWidget * widget
=0x0012feb0,
bool recursive
=true) Line
250 C
++ QtGuid4.dll!QETWidget::translatePaintEvent(const tagMSG & msg={...}) Line 3111 + 0x2b bytes C++
...
> gltest.exe!GLWidget::paintGL() Line 18 C++
QtOpenGLd4.dll!QGLWidget::glDraw() Line 3111 C++
QtOpenGLd4.dll!QGLWidget::paintEvent(QPaintEvent * __formal=0x0012c354) Line 2898 C++
...
QtGuid4.dll!QWidgetPrivate::drawWidget(QPaintDevice * pdev=0x0012feb8, const QRegion & rgn={...}, const QPoint & offset={...}, int flags=3) Line 1212 + 0xd bytes C++
QtGuid4.dll!QWidget::repaint(const QRegion & rgn={...}) Line 1310 C++
QtGuid4.dll!qt_syncBackingStore(QRegion rgn={...}, QWidget * widget=0x0012feb0, bool recursive=true) Line 250 C++
QtGuid4.dll!QETWidget::translatePaintEvent(const tagMSG & msg={...}) Line 3111 + 0x2b bytes C++
...
To copy to clipboard, switch view to plain text mode
whereas updateGL() gets down to business faster:
> gltest.exe!GLWidget::paintGL() Line 18 C++
QtOpenGLd4.
dll!QGLWidget::glDraw() Line
3111 C
++ QtOpenGLd4.
dll!QGLWidget::updateGL() Line
2768 C
++
> gltest.exe!GLWidget::paintGL() Line 18 C++
QtOpenGLd4.dll!QGLWidget::glDraw() Line 3111 C++
QtOpenGLd4.dll!QGLWidget::updateGL() Line 2768 C++
To copy to clipboard, switch view to plain text mode
(I left out the Signal/Slot messaging calls in both examples)
Bookmarks