[visionegg] What happens when swap_buffers is called more than once during one monitor frame?

  • From: Jens Kremkow <kremkow@xxxxxxxxxxxxxxxxxxxxxxxx>
  • To: visioegg mailinglist <visionegg@xxxxxxxxxxxxx>
  • Date: Wed, 10 Feb 2010 17:49:17 +0100

Dear Andrew,

again I have a question regarding the behavior of VE, OpenGL with respect to 
the swap_buffer and when is what presented on the screen.

Since we have to know exactly when, which stimulus frame is presented on the 
screen I added a LPT trigger after the swap_buffers in the go function of the 
Presentation Object. My idea was to have the swap_buffers timing information in 
the raw recording data such that I could reconstruct which stimulus frame was 
presented at each given moment. 

To test this I created a simple stimulus which was composed of a full-field 
flash at different grey values. The grey values were changed by one value, in 
staircase manner, every time the draw function was called. The staircase had 10 
steps and at frame 11 it would start from the same value as it had in frame 1. 
The Stimulus was presented for 11 frames to have one complete staircase and the 
beginning of the second.
Doing this small test I realized that VE sometimes calls swap_buffers twice in 
on monitor frame, because I could see that I had two LPT triggers in one frame. 
Have a look at the attached figure.
The bottom trace is the stimulus, the green channel of the monitor cable. Here 
you can see the staircase.
The LPT Draw makers are the LPT triggers which are send out after the 
swap_buffer.
The Vsync is the vertical synchronization signal also from the monitor cable.

As you can see, after each swap_buffer the stimulus presented on the screen 
changes. However, during the second monitor frame (~2,595 sec) there are two 
swap_buffers, and very interestingly, the next monitor frame has the value as 
if there was only one swap_buffer (The step size of the stair is same). Even 
more interestingly, it seems that this second swap_buffer is somehow remembered 
and carried along, because the staircase is not disturbed. And even two monitor 
frames after the last (11th) swap_buffer (2,66 sec) the monitor content is 
changed (2,68 sec), completing the first staircase and showing the first step 
of the second (the fact that the first step of the second staircase is 
presented for more than one monitor frame is due to the fact that there is a 
sleep after the Presentation, thus no further swap_buffer).

Is that a property of OpenGl that it completes all swap_buffer, even if two had 
been in one monitor frame? Or do I misinterpret the data?

Thanks a lot in advance for your advice.

Regards,
Jens






image/tif

Other related posts: