SetResolution doesnt recognise my 'NearestResolution' width/height dimensions on retina display

Hi all,

I am having issues setting the resolution of my mac’s screen, whereas the resolution changes work with my extended screen.

My software/hardware:

  • I am working in Matlab (9.7.0.1319299 (R2019b) Update 5)
  • Psychtoolbox-3 ('3.0.16 - Flavor: beta - Corresponds to SVN Revision 10582)
  • MacBook pro (MacOS Mojave,13inch 2560 x1600, Intel Iris Plus Graphics 640 1536 MB)
  • Extending to a Philips monitor (27inch, 1920 x 1080 ,Intel Iris Plus Graphics 640 1536 MB graphics)

My reproducible code:
Not sure if the error will reproduce on other systems:
The following works no matter the value of whichScreen

whichScreen = max(Screen('Screens'));
originalRes = Screen('Resolution',whichScreen); %get the original screen resolution
desiredRes = [1920,1080,NaN]; %the desired width and height in resolution
res= NearestResolution(whichScreen,desiredRes); %find the nearest screen resolution to the desired resolution

The following line ONLY works on my extended screen where the value of whichScreen is 1 not 0.

SetResolution(whichScreen, res); %this alters the resolution of the screen to better support cross screen adaption

Error message:

Error in function Resolution: Usage error
Invalid or mutually incompatible video settings requested!
One or more of the values are invalid or unsupported by your display device.
Error using Screen
Usage:
oldResolution=Screen(‘Resolution’, screenNumber [, newwidth][, newheight][, newHz][, newPixelSize][, specialMode]);
Error in SetResolution (line 124)
oldRes = Screen(‘Resolution’, screenNumber, nres.width, nres.height, nres.hz, nres.pixelSize);

Bear in mind I have used ‘Screen(‘Resolutions’,0)’ to check the resolutions of my mac screen and the width/height is fine, but as the Hz is 0 I think this is where the issue lies but i can’t fix.

Setting any resolution than the native one is pointless on a Retina display, as Apples trainwrecks would reward such an act with broken visual timing. PTB will always choose the native Retina resolution, no matter what you try, so this is basically intentional.

You could use the PTB panelfitter (cfe. PanelFitterDemo) to draw and display stimuli at a smaller resolution than the native (or scaled) Retina resolution. It would rescale stimuli from wanted resolution/size to full display size if used correctly.

In general, even on external displays - unless they are CRTs, the Panelfitter approach is better, as digital flat panels or projectors may have degraded display timing if not used at their native resolution and refresh rate.

So changing resolution is mostly only useful nowadays on CRT monitors.