[Qt-interest] Blocking Flip Problem
naiqiao liang
liangnaiqiao at gmail.com
Mon Nov 8 15:33:22 CET 2010
HI,
The problem is that we will sometimes need to update the screen
every vertical retrace, so we can't put in a delay.
The code below is some try to block the flip, but it failed. Could anyone
give me some tips on that. Thanks ahead.
def swapBuffers(self):
# first call the swap on the QGLWidget
self.glw.swapBuffers()
# The following is taken from the PsychToolbox
# Draw a single pixel in left-top area of back-buffer. This
will wait/stall the rendering pipeline
# until the buffer flip has happened, aka immediately after
the VBL has started.
# We need the pixel as "synchronization token", so the
following glFinish() really
# waits for VBL instead of just "falling through" due to the
asynchronous nature of
# OpenGL:
glDrawBuffer(GL_BACK)
# We draw our single pixel with an alpha-value of zero - so
effectively it doesn't
# change the color buffer - just the z-buffer if z-writes are
enabled...
glColor4f(0,0,0,0)
glBegin(GL_POINTS)
glVertex2i(10,10)
glEnd()
# This glFinish() will wait until point drawing is finished,
ergo backbuffer was ready
# for drawing, ergo buffer swap in sync with start of VBL has
happened.
glFinish()
I don't know why the glFinish is not blocking...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101108/094878df/attachment.html
More information about the Qt-interest-old
mailing list