[Qt-interest] QGLWidget 30 fps maximum on Windows XP
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Wed Jan 19 11:47:33 CET 2011
On 2011-01-19 ITS-CMT-SL-SFR-FIN-DEV Knoll Oliver, ITS-CMT-SL-SFR-FIN-DEV wrote:
> ...but I think at that time I unblocked the calculation
> thread each time QWidget::paint() was done,
I actually meant http://doc.qt.nokia.com/4.7/qwidget.html#paintEvent - at this time the widget is really to be repainted, and you know that the GL rendering has finished.
Then you wake-up your "scene calculation thread" (which goes to sleep each time it has re-calculated the scene and emits a (queued!) signal to the GUI, indicating that "there is something new to render") which then calculates the next scene frame.
Like this you don't limit the FPS to some timer interval, but really try to render "as fast as possible" (taking into account the maximum refresh rate of your screen).
Another (simpler) approach, if you really want to stick to a QTimer based approach: start with e.g. 30 FPS, measure the time it actually takes to render a single frame, and if this delta time dt is smaller than 1/30 seconds, then you can decrease the timer interval to e.g. 1/40 seconds (40 FPS), and increase if performance drops etc.
p.s. I seriously doubt that Windows XP itself limits the framerate to 30 FPS: Windows XP has a long (and very successful) "gaming history", and any 1st person shooter gamer will tell you that they reach far higher FPS than just 30 (which is considered very low for hard core 1st person shooter gamers, so I've been told ;) And this is true for both Direct3D and OpenGL based games on WinXP...
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list