[Qt-interest] qtopengl postredisplay?

John McClurkin jwm at nei.nih.gov
Mon Nov 2 14:12:02 CET 2009


_h_ wrote:
> Sorry it is "updateGL()" try with it.
> 
> On Mon, Nov 2, 2009 at 1:06 PM, _h_ <hiralsmaillist at gmail.com 
> <mailto:hiralsmaillist at gmail.com>> wrote:
> 
>     you can call udpateGL() when ever required.
>      
>     Thank you.
> 
>      
>     On Mon, Nov 2, 2009 at 11:57 AM, shuda Li <lishuda1980 at gmail.com
>     <mailto:lishuda1980 at gmail.com>> wrote:
> 
>         Dear All,
> 
>         I am currently trying to build an application using opengl in qt
>         for which accurate bufferswaps (one for every opportunity) is
>         critically important. Using glut, I can simply set
>         wglSwapInterval(1); and use glutPostRedisplay after calling
>         glutSwapBuffers to call my drawing function again.
>         I have found the swapinterval setting in QT, but I am unable to
>         have my PaintGL called automatically, I have to use a timer
>         which jeopardizes swap accuracy (my framerate is not constant, i
>         miss swaps sometimes).
> 
>         Is it possible to have PaintGL called automatically, without a
>         timer?
> 

You have to be careful when calling updateGL() directly because this 
side steps the Qt event loop. It you call updateGL() repeatedly, your 
GUI will become unresponsive. It is better to call update() on the 
openGL widget. To get the maximum buffer swap rate, call update() at the 
end of the paintGL() function. At the beginning of the paintGL function 
put a test to determine if anything needs re-drawing.



More information about the Qt-interest-old mailing list