Psychophysics Toolbox with multiple monitors under Windows

To display visual stimuli, I am using the Psychophysics Toolbox for Matlab, developed by David Brainard, Denis Pelli and Allen Ingling. It looks as if it is going to be an excellent, straightforward way of displaying visual stimuli. The Toolbox handles all the low-level OpenGL stuff, and I am free to do all my image generation, data collection and analysis in the high-level Matlab language, which I like very much.

Span Mode

Unfortunately, Psychophysics Toolbox was originally developed for the Mac, and when I started using it, the Windows version was lacking several aspects, including multiple monitor support. At first I thought this was going to be fatal, but then I found out from Maurice Smith and Mario Kleiner that there is a work-around. NVidia dual-head graphics cards have a span mode, in which they represent two monitors to Windows as a single big monitor. This is different from the usual Extended Desktop, in which Windows uses two monitors, because here Windows believes it is just connected to one large monitor. This is shown in the screenshot on the left (click for a high-res version), where Display 1 appears as a single monitor of 2560×1024 pixels. It is in fact both my projectors. I just have to display my left-eye’s image on the left of this screen, and my right eye’s image on the right, and PsychToolbox will do this for me automatically using stereomode=4.

I am using a NVidia Quadro NVS 280 PCI-E dual-head graphics card. To begin with, this did not seem to “do” span mode, but I just needed to update the drivers off NVidia’s website. To control the mode — span, single, clone or whatever — just go to Windows Control Panel (classic view), hit Display, then Settings, then Advanced (see screenshot in the paragraph above). This gets you a bunch of tabs including one for the graphics card, and you can then select span mode. The screenshot below, left, is how this looked when I first installed the NVidia drivers. In Feb 2007, I updated them, and now there is a special NVidia Control Panel, shown in the screenshot on the right.

However, as of February 2007 Psychtoolbox can handle multiple monitors under Windows (see below), so I am planning to move to Dual-View, where Windows knows about each of the projectors. The major advantage of this is that I will be able to apply exactly the right gamma-correction for each of them individually.

Gamma correction buglet
The projectors have a gamma correction tool, but I can’t get the output completely linear just using the projector settings — at the top end of the slider, the luminance/pixel-value curve is still supralinear. So I also looked at using the gamma slider on the dualhead graphics card to linearise the output. I hit a problem to begin with, because when I adjusted the gamma slider with the projectors in horizontal span mode, the new gamma only applied to the left-hand side of the “screen”, i.e. only to one projector. This obviously represents a bug in the graphics card software, so I thought I was stuck. But my M.Sc. student Graeme Phillipson suggested a workaround — we changed the dualhead graphics card to “single display” mode, so that Windows now saw 3 screens (the monitor, and two projectors). This gave us a gamma slider for each projector separately, and we set both of these to the desired value. Then when we went back to horizontal span mode, we had the desired gamma value right across the screen.

Second graphics card

With the computer displaying only on the projectors, it’s very difficult to use the computer. The projector screen is physically a long way from the computer keyboard and mouse; plus the computer is behind the screen (in order to be near the projectors), so I end up looking at the display from the back, not the front, and the display on the rear-projection screen does not look great from this side. Most seriously, the computer is set up to have its display spread over both projectors as if these were displaying next to each other, but in fact they are superimposed on the screen. You can imagine how hard this makes it! You click the mouse cursor on a button, but nothing happens, because the mouse cursor is actually a whole screen away from the button. So, I needed a third display in order to interact with the computer and control the experimental stimuli. The most elegant solution would have been to have bought a four-output graphics card, but I did not do this, because at the time I ordered the card, I was expecting to use a video-splitter to drive the projectors. So, as a cheaper solution, I installed a second graphics card (an NVidia GeForce 6200 128Mb, 40 pounds from Dixons) into the computer’s PCI socket. I have never installed an additional graphics card before, and I wasn’t expecting it to be so simple. The NVidia installation software warned me I must uninstall all existing drivers before installing the drivers for the GeForce card, which of course I didn’t want to do, because I still wanted to use the NVidia Quadro to drive the projectors. So, I just went ahead and installed the new drivers without uninstalling the old ones, rebooted and much to my surprise it all worked. In “Control Panel->Display->Settings”, I now see three monitors, of which two are in use. Monitor 1 represents the two projectors. In “Display->Settings”, it is described as “1. (Default monitor) on NVIDIA Quadro CI-E Series”. Monitor 2 represents the CRT monitor. It is described as “2. Plug and Play Monitor on NVIDIA GeForce 6200.” To see detailed settings for each graphics card, select the appropriate monitor on “Display->Settings”, click “Advanced” and then click the tab labelled with the graphics card’s name (Quadro NVS 280 PCI-E or GeForce 6200)

The projectors have to be designated the primary monitor, as Psychophysics Toolbox can only use the primary monitor in Windows (see below). However, you can make the secondary monitor display the Windows start bar, which is convenient.

Updating graphics drivers

My graphics card is a NVidia Quadro NVS 280 PCI-E dual-head graphics card. To update the NVidia drivers to make sure they are current, first uninstall the existing drivers by going to Windows Add Or Remove Programs, selecting NVidia drivers and selecting Remove. Then go to NVidia’s website, www.nvidia.com, and select “Graphics drivers”, “Quadro” and “Windows XP Professional x64”.

I last updated in Feb 2007, to ForceWare Release 80, Version 84.26, Release date April 18, 2006. I then updated the GeForce drivers for the PCI card running the CRT.

Multiple-monitor support in PTB-3

In July 2007, Mario Kleiner updated Psychtoolbox to handle multiple monitors under windows. The following notes were written in Feb ’07, using Psychtoolbox 3.0.8, Flavor: beta (SVN Revision 657), running on a PC with Windows XP. To find the version of Psychtoolbox on your system, use PsychtoolboxVersion.

Feb 07 — Experimenting with the new version, I have found that PTB will reliably report all the monitors present, but it will not necessarily display on all these. One thing that you may need to do is pass the correct rectangle for your monitor — obtain >rect=Screen('Rect', ScreenNumber); and then pass this using Screen('OpenWindow',2,rect); Playing around with the CRT and one projector (after the other one was away for repairs), I found I could only get a PTB window open on whichever was the primary display. If the CRT was primary, then I could open a window on the CRT, but trying to open one on the projector gave me synching errors. I tried making the CRT refresh rate 60Hz to match the projector, and changing the vertical synch from “Application Controlled” to “On” in the graphics card, but neither helped. Conversely, if the projector was primary, then I could open a window on the projector, but trying to do so on the CRT hung Matlab. This was so whether or not I passed the rectangle to Screen OpenWindow.

So in my experience, PTB currently supports multiple monitors, but only if they are all attached to the same graphics card, and only if one of the monitors on that card is set to be the primary display. It will correctly detect all monitors present (irrespective of which card they are on and whether they are primary), but will only open a window on a monitor on the same graphics card as the primary.

It is a small pain having one of the projectors be primary monitor, because new applications/windows tend to appear there, rather on the CRT where they would be more useful. It means you need to fire up the projectors to see what you are doing, even if you only wanted to change something in the code without necessarily displaying it on the projectors. However, it is probably a good idea to have the experimental stimulus display be primary. Mario Kleiner tells me that in Windows, “primary really means primary”, i.e. you are likely to get better performance on the primary display. With a bit of trial and error, I can get the start bar to appear on the CRT even though it is the secondary monitor. I think what you do to achieve this is force the start bar onto the CRT by setting that as the only monitor, reboot, then extend Windows onto the projector, then set the projector as primary. Once you’ve got it like that, it will stay that way even after a reboot. Matlab also remembers where you last had it on the desktop, so when you fire up Matlab it still appears on the CRT.

Useful Psychtoolbox commands relating to monitors

To access Psychtoolbox’s own detailed help on these, type (for example) Screen Screens? at the Matlab prompt, after installing Psychtoolbox (see the Psychtoolbox site).

  • Screen('Screens')
    This gives a description of all display devices found by PTB. To find out more about the properties of these display devices, use the following:
  • [width, height]=Screen('DisplaySize', ScreenNumber); This gives the physical width and height of the monitor ScreenNumber, in millimetres as reported by the display device itself to the OS.
  • rect=Screen('Rect', ScreenNumber);
    The size of the monitor ScreenNumber in pixels.
  • [width, height]=Screen('WindowSize', windowPointerOrScreenNumber);
    Returns the width and height of a window or screen in pixels.
  • hz=Screen('NominalFrameRate', 0);
    Returns or sets the nominal video frame rate in Hz, as reported by the computer’s video driver.

Leave a Reply

Your email address will not be published. Required fields are marked *