Hi everyone,
I’ve setup a Psychtoolbox experiment that uses a main loop to check for specific (3rd party hardware) input while calls to AsyncFlipBegin
and AsyncFlipCheckEnd
are being made to control what is drawn on the screen.
All the way at the end of that loop, the following code checks whether the escape-key is pressed:
[~, ~, code] = KbCheck(-1);
if code(27)
running = 0;
break;
end
Pressing esc immediately breaks the loop and should end the program.
Straight after the loop sca()
is called. Exiting the loop works perfectly, I’ve checked with console output.
However, the problem is that it (sca
) waits for asynchronous flips to finish (AsyncFlipEnd
is in there), causing a 10 to 20-second delay for the window to close. I had no luck finding a psychtoolbox function to interrupt the AsyncFlipBegin
call, nor could I find a solution on this forum.
Interrupting such an asynchronous event or closing down the Psychtoolbox/GL loop before a planned event seems pretty straightforward, so I probably overlooked something very simple.
Would you be able to point me in the right direction?
Thanks in advance
Max