# Question about the timing of Screen Flip

**URL:** https://psychtoolbox.discourse.group/t/question-about-the-timing-of-screen-flip/812
**Category:** Uncategorized
**Created:** [April 18, 2013, 3:16pm UTC](https://psychtoolbox.discourse.group/t/question-about-the-timing-of-screen-flip/812 "2013-04-18T15:16:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)
#### Post date: [April 18, 2013, 3:16pm UTC](https://psychtoolbox.discourse.group/t/question-about-the-timing-of-screen-flip/812/1 "2013-04-18T15:16:56Z")

</div>

I tried a simple code including the following lines. So the screen was flickering at 15 Hz, with 60 Hz of monitor refresh rate.  
  
...  
waitframe = 1;  
ifi = Screen('GetFlipInterval',w);  
tvbl = Screen('Flip',w);  
tvbls = [];  
k = 1;  
while ~KbCheck  
 Screen('FillRect',w,128-127\*(-1)^k);  
 tvbl = Screen('Flip',w,tvbl+(waitframe-0.5)\*ifi);  
 tvbls = [tvbls tvbl];  
 k = 3-k;  
end  
...  
  
  
I though the result of diff(tvbls) would be around .033 (i.e. 2\*ifi). But I found they were around .0267. But if waitframe was set to zero, i.e. the screen flip at every vertical retrace, diff(tvbls) became closely around .016. Why?

---

<div class="post-metadata">

### Author: ![dcnieho](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dcnieho](https://psychtoolbox.discourse.group/u/dcnieho)
#### Post date: [April 18, 2013, 3:46pm UTC](https://psychtoolbox.discourse.group/t/question-about-the-timing-of-screen-flip/812/2 "2013-04-18T15:46:32Z")

</div>

That is funny. What operating system are you running (version, etc all the details) and what graphics card? You are using a fullscreen window, right?

 

Best,

Dee

  
  

> On Thu, Apr 18, 2013 at 11:16 PM, ptbmin \<[ptbmin@...](mailto:ptbmin@...)\> wrote:  
> 
> > I tried a simple code including the following lines. So the screen was flickering at 15 Hz, with 60 Hz of monitor refresh rate.  
> >   
> > ...  
> > waitframe = 1;  
> > ifi = Screen('GetFlipInterval',w);  
> > tvbl = Screen('Flip',w);  
> > tvbls = [];  
> > k = 1;  
> > while ~KbCheck  
> > Screen('FillRect',w,128-127\*(-1)^k);  
> > tvbl = Screen('Flip',w,tvbl+(waitframe-0.5)\*ifi);  
> > tvbls = [tvbls tvbl];  
> > k = 3-k;  
> > end  
> > ...  
> >   
> > I though the result of diff(tvbls) would be around .033 (i.e. 2\*ifi). But I found they were around .0267. But if waitframe was set to zero, i.e. the screen flip at every vertical retrace, diff(tvbls) became closely around .016. Why?

---

<div class="post-metadata">

### Author: ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)
#### Post date: [April 19, 2013, 8:41am UTC](https://psychtoolbox.discourse.group/t/question-about-the-timing-of-screen-flip/812/3 "2013-04-19T08:41:35Z")

</div>

I tried the same code on another computer, and the results looked OK. Both computers are installed with Windows 7. The difference is the one I tried yesterday has two graphics cards with the nVidia Optimus technique. It seems the Optimus technique messed up everything.   
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Diederick C. Niehorster" \<dcnieho@...\> wrote:  
> \>  
> \> That is funny. What operating system are you running (version, etc all the  
> \> details) and what graphics card? You are using a fullscreen window, right?  
> \>   
> \> Best,  
> \> Dee  
> \>   
> \>   
> \> On Thu, Apr 18, 2013 at 11:16 PM, ptbmin \<ptbmin@...\> wrote:  
> \>   
> \> \> \*\*  
> \> \>  
> \> \>  
> \> \> I tried a simple code including the following lines. So the screen was  
> \> \> flickering at 15 Hz, with 60 Hz of monitor refresh rate.  
> \> \>  
> \> \> ...  
> \> \> waitframe = 1;  
> \> \> ifi = Screen('GetFlipInterval',w);  
> \> \> tvbl = Screen('Flip',w);  
> \> \> tvbls = [];  
> \> \> k = 1;  
> \> \> while ~KbCheck  
> \> \> Screen('FillRect',w,128-127\*(-1)^k);  
> \> \> tvbl = Screen('Flip',w,tvbl+(waitframe-0.5)\*ifi);  
> \> \> tvbls = [tvbls tvbl];  
> \> \> k = 3-k;  
> \> \> end  
> \> \> ...  
> \> \>  
> \> \> I though the result of diff(tvbls) would be around .033 (i.e. 2\*ifi). But  
> \> \> I found they were around .0267. But if waitframe was set to zero, i.e. the  
> \> \> screen flip at every vertical retrace, diff(tvbls) became closely around  
> \> \> .016. Why?  
> \> \>  
> \> \>   
> \> \>  
> \>
