Hi everyone!
In my script I flip an offscreen window, wait for the detection of an event and then flip a second offscreen window as fast as possible. The image textures that I draw to the first and the second offscreen window are supposed to have exactly the same size and position. However, in some but not all instances, the second image appears in a slightly different position. The difference is just big enough to detect it, but seems to be only about one or two pixel. I would be grateful for any pointers for solving this problem, thank you!
% prepare first offscreen window
image_1 = imread(strcat(impath, current_image_name_1,‘.jpg’));
texture_1 = Screen(‘MakeTexture’, window, image_1);
offscreen_1 = Screen(‘OpenOffscreenWindow’, window, 0, );
Screen(‘DrawTextures’, offscreen_1, texture_1, , dstRects);% prepare second offscreen window
image_2 = imread(strcat(impath, current_image_name_2,‘.jpg’));
texture_2 = Screen(‘MakeTexture’, window, image_2);
offscreen_2 = Screen(‘OpenOffscreenWindow’, window, 0, );
Screen(‘DrawTextures’, offscreen_2, texture_2, , dstRects);% flip lines and first offscreen window
Screen(‘DrawLines’, window, ArrowCoords, lineWidth, white, [xm ym], 2);
Screen(‘CopyWindow’, offscreen_1, window, dstRects, dstRects)
[VBLT, StimulusOnset, FlipTimestamp, missed, beampos] = Screen(‘Flip’, window);% […] (code for detecting event)
% as soon as the event is detected, flip lines and second offscreen window
Screen(‘DrawLines’, window, ArrowCoords, lineWidth, white, [xm ym], 2);
Screen(‘CopyWindow’, offscreen_2, window, dstRects, dstRects);
[VBLT, StimulusOnset, FlipTimestamp, missed, beampos] = Screen(‘Flip’, window);
Psychtoolbox version: 3.0.15 - Flavor: beta
MATLAB version: 9.5.0.944444 (R2018b)
Intel(R) Core™ i7-7820HK CPU @ 2.90GHz; RAM 64 GB; Windows 10
graphics card driver: NVIDA GeForce GTX 1080, version: 25.21.14.1735
screen: 24.5" Full HD 1920x1080p 240Hz