| Reference | Downloads | Github

Unexpected vsync behaviour with waitBlanking=False

Hi everyone,

I’ve been trying to get an experiment to run without vertical sync (by setting waitBlanking=False during window creation). However, no matter what waitBlanking is set to the main loop is locked to a 60Hz frame rate. Here’s a reasonably minimal reproducible example:

from __future__ import absolute_import, division
from psychopy import gui, visual, core, data, event
import pyglet

# full_screen, backend and vsync are the 3 variables we're looking at
full_screen = True
backend = "pyglet" #'pyglet', # 'pygame', #'glfw',
vsync = True

win = visual.Window(fullscr=full_screen,
                    monitor='testMonitor', color=[-1,0,-1], colorSpace='rgb', blendMode='avg', 
                    mouseVisible = True, allowGUI=False)
print ("Monitor refresh time is ", win.monitorFramePeriod)

stim = visual.ShapeStim(win, vertices=[(-2,2),  (2,2),  (2,-2),  (-2,-2)], fillColor='white', lineWidth=0, opacity=1, units='cm')

# ============================= START MAIN LOOP
start_time   = stimClock.getTime()
time_elapsed = stimClock.getTime() - start_time

trial_length = 1 # seconds

flip_time = 0
loop_count = 0
while time_elapsed < trial_length: 
    print("loop ", loop_count, ' with time elapsed:', time_elapsed, " and time flipped is ", flip_time) 

    stim.draw ()     # Draw _something_ just to try and make things as valid as possible..

    time_elapsed = stimClock.getTime() - start_time

    flip_time = win.flip()
# ============================= END MAIN LOOP

print("Performed", loop_count, "loops. Last flip time recorded as ", flip_time) 

# Wait for button press

Using the ‘pyglet’ back-end I’ve tested this on Windows 10 with an NVidia card, and on Mac OSX with an integrated Intel GPU (both with 60Hz monitors). Both exhibited the same behaviour. I’m also seeing different/conflicting results using other backends. Does anyone know why this would be happening?