Screen GetImage

I am not sure if this is expected behaviour, but on macOS

Screen(‘GetImage’, window)

Gives the Psychtoolbox startup window with the frog, regardless of what is on the screen. Specifying the back or draw buffer results in expected behaviour i.e. capturing what is displayed. Thus is seems to be an issue with capturing the front buffer.

I am running Tahoe 26.5, but if my memory is correct, seem to remember having discovered this prior to Tahoe (but failing to report it).

I have not tested it on other operating systems as far as I can remember.

The code below will reproduce the possible error

Peter

*****

% Clear the workspace and the screen

sca;

close all;

clear;

% Here we call some default settings for setting up Psychtoolbox

PsychDefaultSetup(2);

% Get the screen numbers

screens = Screen(‘Screens’);

% Draw to the external screen if available

screenNumber = max(screens);

% Open an on screen window

[window, windowRect] = PsychImaging(‘OpenWindow’, screenNumber, [rand rand rand]);

% Flip to the screen

Screen(‘Flip’, window);

% Capture the screen image

imageArray = Screen(‘GetImage’, window, [], ‘FrontBuffer’);

imwrite(imageArray, [cd ‘/exampleCapture.jpeg’])

% Clear the screen

sca;

*****

I should have also said I am using the latest PTB for Apple Silicon.

It’s a known limitation, well, known to myself. I guess the help text needs some update.

One can’t implement the correct semantics of using a ‘frontBuffer’ read when using the Vulkan display backend, which is always used on Apple Silicon macOS with fullscreen windows, or iirc any of the special display backends for VR, at least not without adding a lot of complexity and destroying performance. It is unfortunate that ‘frontBuffer’ is the default if one doesn’t specify a buffer explicitly. That was a suboptimal choice from the beginning, but backwards compatibility…