I seem to be having trouble creating a true array of textures...
I am setting up the array like this:
instIMG(1)=Screen('MakeTexture', MainWindow, double(imread('Slide1.png')));
instIMG(2)=Screen('MakeTexture', MainWindow, double(imread('Slide2.png')));
instIMG(3)=Screen('MakeTexture', MainWindow, double(imread('Slide3.png')));
instStim = zeros(1,3);
for o = 1:3
instStim(o) = Screen('OpenOffscreenWindow', MainWindow, [], [0 0 1134 708]);
Screen('DrawTexture', instStim(o), instIMG(o));
end
...and then trying to use like this later:
Screen('DrawTexture', stimWindow, instStim(InstCnt), [], []); % Instruction 1
...where InstCnt is a counter which increments with user clicks of the mouse.
If I do it like that it coughs up a screen error regrading use of Screen. But if I do it like this:
switch InstCnt
case 1
Screen('DrawTexture', stimWindow, instStim(1), [], []); % Instruction 1
case 2
Screen('DrawTexture', stimWindow, instStim(2), [], []); % Instruction 2
case 3
Screen('DrawTexture', stimWindow, instStim(3), [], []); % Instruction 3
end
...it works fine. But that pretty much defeats the point of creating the array in the first place.
Thanks for your help
Tom
I am setting up the array like this:
instIMG(1)=Screen('MakeTexture', MainWindow, double(imread('Slide1.png')));
instIMG(2)=Screen('MakeTexture', MainWindow, double(imread('Slide2.png')));
instIMG(3)=Screen('MakeTexture', MainWindow, double(imread('Slide3.png')));
instStim = zeros(1,3);
for o = 1:3
instStim(o) = Screen('OpenOffscreenWindow', MainWindow, [], [0 0 1134 708]);
Screen('DrawTexture', instStim(o), instIMG(o));
end
...and then trying to use like this later:
Screen('DrawTexture', stimWindow, instStim(InstCnt), [], []); % Instruction 1
...where InstCnt is a counter which increments with user clicks of the mouse.
If I do it like that it coughs up a screen error regrading use of Screen. But if I do it like this:
switch InstCnt
case 1
Screen('DrawTexture', stimWindow, instStim(1), [], []); % Instruction 1
case 2
Screen('DrawTexture', stimWindow, instStim(2), [], []); % Instruction 2
case 3
Screen('DrawTexture', stimWindow, instStim(3), [], []); % Instruction 3
end
...it works fine. But that pretty much defeats the point of creating the array in the first place.
Thanks for your help
Tom