for Mac OS 9
Note: This is the web site for Version 2 of the Psychtoolbox. Version 2 is no longer under development and this site is not actively maintained. See http://psyctoolbox.org for the web site for Psychtoolbox Version 3.
OS9: Psychtoolbox
Links
Mac OS X: Classic
Classic doesn't synch to blanking 
Matlab bugs
Student Matlab bugs
Free upgrade to Matlab 5.2.1
Version numbers
Backwards incompatibilities
Graphics driver updates & bugs
Psychtoolbox bugs
History of changes
Credits
August 2003 UPDATE: All development efforts are focused on the imminent release of the Psychtoolbox for Mac OS X. This effort will be maintained until that release stabilizes, reaching the same level of reliability and polish as the Mac OS 9 version, which is practically bug-free. The Windows version has known bugs and limitations that we don't have the resources to address. The new Mac OS X release is built partly on OpenGL, a graphics library available for Mac, Windows, Linux and many other operating systems. We plan to port the new release to Windows but that will occur only after it reaches a polished state on Mac OS X. This is our attempt to give the maximum research-enabling benefit to the greatest number of users, since the user community for Psychtoolbox is still more than half Mac users.
-Allen Ingling, David Brainard, and Denis Pelli.
The new Psychtoolbox function LoadClut provides transparent support for all graphics cards, including those with more-than-8-bit DACs. We recommend the ATI Radeon 8500 card, which has 10-bit DACs, CopyBits 180 MB/s, and costs $300.
Psychophysics Toolbox for Mac OS 9
The Mac version is stable and polished, and more or less bug-free. Hundreds of scientists are using it. See intro for an overview, MovieDemo.m for an example, or history for the latest changes. Or read the very short list of known bugs.
We suggest all Mac OS 9 users upgrade to the latest Psychtoolbox, which requires Matlab 5.2.1, the latest and greatest. It would be possible to use the current Mac Psychtoolbox with Matlab 5.0, 5.1, or 5.2, with minor incompatibilities that you could overcome, but there's no reason to. We suggest that all Mac OS 9 users upgrade to Matlab 5.2.1.
A present the Mac Psychtoolbox requires Mac OS 8 or 9, or Classic. We will support Mac OS X Matlab in the next major release; see future plans.
Links
How to write portable scripts, compatible with both Mac and Win
Win vs. Mac differences
G4 floating point twice as fast as G3
Compatible with G3, G4, and Mac OS 9
Future plans
Mac OS 9

Matlab and the Psychophysics Toolbox run very well on the PowerMac PowerPC and G3 and G4 computers with Mac OS 8 and 9, including the latest, 9.2.2. The G4 has significantly improved floating point performance, so Matlab flies!
Mac OS X Classic 
The Mac OS X "Classic" environment emulates Mac OS 9. In our limited testing, Matlab 5.2.1 runs fine in the Classic environment. Although much of the OS 9 Psychtoolbox will run in this mode, the Classic environment does not provide a mechanism to synchronize to the display's vertical blanking (see below). Without this ability, running the toolbox under Classic/Matlab 5.2.1 is not viable for serious work.
An Apple Knowledge Base article notes that Mac OS X 10.2 Classic limits the amount of Temporary memory (shared among all running Classic applications) to less than 128 MB. (Thanks to Frans Cornelissen who culled this from www.macintouch.com.)
Our floating point benchmark, reported by DescribeComputer, shows that FFT2, the only computation in Pelli's lab that observers need to wait for, runs at the same rate under Classic and under Mac OS 9.2.1. Matlab's built-in benchmarks provided by BENCH test a wider range of tasks, with results shown in the figure below.

The green bars show the basic result. The gray bars show what one gets by tweaking, using the unix command "renice" to assign the highest possible priority (-20) to the Classic process. The vertical scale is speed, running under Mac OS X Classic, relative to speed under Mac OS 9.2.1. The name of each test is provided along the horizontal axis. The first test is ours (in DescribeComputer) for Matlab's FFT2 command. The rest are from Matlab's BENCH command.
HELP BENCH says that "LU" is mostly floating point (Matlab's "LINPACK"), and LU agrees with FFT2 in showing nearly the same (96%) speed under Classic. Increasing the priority brings the LU speed up to 100%. The biggest effect in the BENCH results is the 3-D test ("Surf plot of 'peaks', 3-D polygonal fill graphics") which runs at 71% speed under Classic (standard priority) or 91% (max priority). Even that difference seems too small to matter to most users. We conclude that Matlab does run slightly more slowly under Classic than under Mac OS 9, but the difference is negligible.
Classic doesn't synch to blanking!
All the PsychDemos and PsychTests run fine under Classic, but several (FlickerTest, PeekBlankingTest) indicate irregular timing of the graphics driver blanking interrupt. It appears that the "blanking" interrupt is simulated, occurring at a nominally regular interval of arbitrary phase, not actually tied to the video card's blanking signal. Furthermore the interrupt is often randomly delayed by milliseconds, apparently as a result of interruptions by other Mac OS X processes. The poor synchronization produces visible artifacts, which FlickerTest reveals clearly. This won't matter at all for experiments that only need to present static stimuli, but is a concern for presentation of movies.
In the past, since Mac OS 6, the blanking interrupt has generally been reliable. [Only one exception was reported, on a particular PowerBook model. As here, it appeared that the interrupt was simulated, not locked to the screen blanking.] However, whenever possible, we have always preferred to rely on SetClut's common side effect of waiting for blanking. If one manipulates all of the latest driver controls documented by Apple, most graphics drivers offer the feature of having SetClut (i.e. cscSetEntries and cscDirectSetEntries) wait for blanking before returning. Alas, this is not true of the two drivers (for built-in screen and the external graphics port) provided by Classic on the PowerBook G4/500 that we tested.
However, there is still cause for hope. OpenGL offers synchronization, which we haven't explored yet.
Synchronizing one's program to the display has always been one of the hardest things to achieve across the whole gamut of video drivers. Each new generation of Macs and graphics cards seems to bring new issues. Each new driver requires testing, and many require special tricks. Screen.mex, in the Psychtoolbox, has always tried to take care of this for the user, so that the user can simply write Screen 'WaitBlanking' and rely on Screen to do the right thing to get the desired behavior out of whatever driver is in use. (However, we do suggest running ScreenTest, and now FlickerTest, to make sure it succeeds.) Currently, Screen uses the SetClut side effect, if available, or waits for the blanking interrupt. It appears that success under Classic will require developing a third solution, based on OpenGL. We'll keep you posted.
In the meantime, we believe that Psychtoolbox and Matlab under Classic are fine for static stimuli, and we hope users will write to the forum, confirming or disconfirming this impression.
An Apple Knowledge Base article notes that Mac OS X 10.2 Classic limits the amount of Temporary memory (shared among all running Classic applications) to less than 128 MB. (Thanks to Frans Cornelissen who culled this from www.macintouch.com.)

Mac: Bugs in Matlab 5.2.1

There are very few bugs in Matlab 5.2.1. Over the years, we have faithfully reported Matlab bugs to Mathworks as we discovered them, and were very pleased to discover that nearly all were fixed in 5.2.1, released July 31, 1998. Here are the few remaining bugs that we know of, mostly discovered since 5.2.1 was released. The M files documenting these bugs reside in the PsychMatlabTests subdirectory of the Psychtoolbox. (See download page to upgrade from MATLAB 5.2 to 5.2.1)
| Case ID |
|
M file |
|
Bug |
| 84454 |
|
ConcatenationBug |
|
Square and curly braces sometimes can't embrace multiple lines. |
| 201530 |
|
fprintfBug |
|
FPRINTF may interpret the first argument as a filename. |
| 297266 |
|
fprintfEmpty |
|
FPRINTF terminates when it gets an empty matrix []. |
| 319124 |
|
fprintfLeak |
|
FPRINTF leaks memory (uses up the Temp memory heap). |
| 41758 |
|
helpLinelength |
|
HELP terminates if a line exceeds 131 characters. |
| 187040 |
|
iminfoBuglet |
|
IMINFO gives misleading error message. |
| 230201 |
|
SpuriousDebuggerError |
|
Matlab debugger works, but gives a spurious error message. |
| 230202 |
|
StaleDirectoryCacheBug |
|
Matlab's directory cache is not updated when you add files to /toolbox/. |
| 297565 |
|
ylabelBug |
|
YLABEL command (in Matlab plots) bug and work around. NOTE: Jon Jacobs's "TextEnd" patch fixes this bug. Download Jon Jacob's TextEnd patch (28 KB). |
|
|
OpenDLGCloseTest |
|
INPUTDLG and QUESTDLG fail to correctly restore the current port. |
If you find a bug in Matlab, please report it to Mathworks: bugs@mathworks.com. You can help your friends by sending a copy (cc: psychtoolbox@yahoogroups.com) to the Psychtoolbox forum.
Mac: Bugs in Student Matlab 5.0

Student Matlab is a very inexpensive way to buy Matlab to try it out, costing less than $100. It includes the Signal Processing Toolbox.
Version 2.35 of the Psychtoolbox was fully compatible with Matlab 5.0 (regular andStudent edition) or better. It's still available. Subsequent versions of the Psychtoolbox have only been tested with Matlab 5.2.1, and some incompatibilities with version 5.0 have crept in. A few programs run afoul of the Student edition's maximum array size, but they could easily be fixed to respect it. We suppose that all these minor incompatibilities could easily be worked around if someone really wanted to run 5.0, but 5.0 (regular and Student editions) is so buggy that this scenario seems unlikely.
Buying it:
- Student Matlab 5 costs less than $100. It's published by Prentice Hall as a book with an enclosed CD-ROM containing the software. Make sure you get version 5 (or better), published in 1997, not the obsolete version 4, published in 1992.
Student Matlab 5.0 Limitations:
- Its only difference from the regular edition is a limit on the maximum array size to be no more than 2^14 elements, eg the largest square matrix is 128x128. To make your programs compatible with both Student and regular editions of Matlab, you may want to use the built-in function COMPUTER to determine the current upper limit on array size:
[c,maxElements]=computer
- The most recent version of Student Matlab is 5.0, issued in December 1996, whereas regular Matlab 5.2.1 was issued in July 1998.
Matlab 5.0 Bugs (common to regular and Student editions), fixed in later versions:
- Matlab 5.0 has a file-caching bug, so if you run an M file or script, edit it, and then hit Command-E, Matlab runs the old version (but, to really confuse you, error messages display text from the new version). Typing "clear all" (to flush the cache) before hitting Command-E works ok.
- Matlab 5.0 makes a spurious call to the Mac OS GetMenuBar before each call to any MEX, which wastes 0.4 ms every time, and leaks 64 bytes of memory. You can use the Psychtoolbox PatchTrap to substitute a dummy routine for GetMenuBar, eliminating the bug. See LeakTest.m and PatchTrap.mex.
Mac: Mathworks's free patch upgrades Matlab 5.2 to 5.2.1 
5.2.1 fixes many bugs. See release notes.
- 5.2.1 adds an undocumented new feature, especially for users of the Psychophysics Toolbox. You can now set Matlab's Backgrounding preference 'on' or 'off' from within your Matlab program, and the function returns the former setting: oldSetting=system_dependent('backgrounding',setting);
Since that function is cryptically named, undocumented, and unique to version 5.2.1 of Matlab, we have enhanced Screen Preference Backgrounding to provide a portable documented interface to the underlying functionality. We suggest that you put the following statement near the top of programs for which you want backgrounding off:
Screen('Preference','Backgrounding',0);
In 5.2.1, the GESTALT function no longer gives a fatal error if the selector is not recognized, so we can now use GESTALT to test for the presence of optional Mac OS features, like speech or the control strip. To find out which selector to use, consult René Ros's Gestalt Selectors List.
Version numbers
- The Psychtoolbox version is a three digit number, e.g. 2.30, but trailing zeroes may be omitted, e.g. 2.3. We bump the first digit for a major change in functionality. We bump the second digit when new features are added. We bump the third digit for each new release, mostly bug fixes. (In the past, we've occasionally issued several releases with the same version number, bumping only the date on each release.) PsychtoolboxVersion.m and PsychtoolboxDate.m return the version number and date, so your programs can check or report them (try DescribeComputer.m). When the third digit of the version is zero, it's a beta release: the user community hasn't yet put it through its paces. Don't be shocked if you find a bug in a beta release; do tell us so we can fix it. (The ideal bug report is a few lines of Matlab code that demonstrate the problem and a report from ScreenTest.m to document the environment.)
- We announce new releases. If you would like to be added to the mailing list, register as a user (using the installer) or just send email to psychtoolbox@psych.nyu.edu. The dates on changes/bugs notes and on the download page are intended to help you keep track of what's happening.
Backwards incompatibilities
Changes that may break old programs are flagged with a caution sign and colored aquamarine.
Mac: Graphics driver updates & bugs
| 10-bit-accurate cards |
|
|
| ATI Radeon 7000 |
CopyBits 13 to 80 MB/s |
$130 |
| ATI Radeon 8500 |
CopyBits 180 MB/s |
$300 |
| ATI Radeon 9000 Pro |
CopyBits 300 MB/s |
Apple |
We recommend the ATI Radeon 7000, 8500, and 9000 Pro, which have 10-bit DACs with driver support. The 9000 Pro is only available through Apple. Each of these three cards can drive two displays, independently, at once. Each requires an AGP slot. They are the only Mac graphics cards on the market that have passed all our tests for 10-bit accuracy. To attain 10-bit accuracy on the 7000 you must use the free ROM updater from ATI. The CopyBits speed of the 7000 is remarkably slow and depends on odd details (see long table below). ATI has acknowledged the problem but hasn't committed to fixing it.
Many users are reporting trouble synching to blanking when running Matlab in the Mac OS X Classic environment. Classic seems to be fine in most ways, but at the moment there is no way to synch to blanking under Classic. We can only suggest that you use static stimuli or return to Mac OS 9. Read our report.
An Apple Knowledge Base article notes that Mac OS X 10.2 Classic limits the amount of Temporary memory (shared among all running Classic applications) to less than 128 MB. (Thanks to Frans Cornelissen who culled this from www.macintouch.com.)
12/02. ATI has posted on their web site a ROM updater for the ATI Radeon 7000 that fixes the CLUT problems, attaining full 10-bit-accuracy. Yay!
ATI Rage 128 and Rage Mobility 128. Driver updates from ATI. Updates from Apple: 120113. A popular 8-bit-DAC graphics card built-into many PowerMacs. Runs very well ever since Bob Dougherty discovered, in 1999, the priority dipping trick to get SetClut to synch with blanking.
ClutTimeTest passes the ATI Rage Mobility 128 built into Denis Pelli's G4/500 PowerBook, but fails the same chip in David Jones's G3 iBook/600. The built-in ATI Rage Mobility 128 (AGP 2x) "ATY,RageM3p29s" (.Display_Rage128 version 1.0f95) takes only 0.3 ms to do SetClut if cscSetClutBehavior is 0, but takes two frames (at 60 Hz) to do SetClut if cscSetClutBehavior is 1. However, it's quick and waits for blanking if we use the priority dipping trick, explained below.
ATI Radeon card:
9200 (PCI). Steve Engel writes (11 July 2006), "We have the ATI Radeon
9200 (PCI) in a G4 running OS 9 with the latest driver downloaded from ATI's
support page. According to ScreenTest,
ClutTest, and LoadClutTest the card has 10-bit DACs, but TwoBitFlickerTest
and our own photometric measurements indicate that the last 2 bits are not
actually affecting the displayed color."
ATI Radeon cards: 7000, 7200, 7500, 7500 Mobility, 8500, 9000, 9000 Mobility, and 9000 Pro. There are many models of the Radeon. Some are fast (CopyBits 180 MB/s), others are slow (13 MB/s). All have 10-bit DACs, but only some have drivers that allow you to achieve 10-bit accuracy. We recommend 10-bit DACs, because they increase resolution by a factor of 4, which, at least for some experiments, allows direct presentation of threshold contrasts on CRT monitors, without having to resort to tricks. At present the ATI Radeon 7000, 8500, and 9000 Pro are the only Mac graphics cards on the market that have passed all our tests for 10-bit accuracy. We anticipate that the rest of the ATI retail products (Radeon 7200, 9000) will soon follow suit, achieving 10-bit accuracy. We do not expect Mac OS 9 updates of ATI's OEM products (Radeon 7500, 7500 mobility, 9000 mobility, 9000 Pro).
Many of the ATI cards are (or were) only available as built-in options in certain Apple computers. ATI currently (1/03) sells the Radeon 7000 (for PCI slot) for $130 and the 8500 (for AGP slot) for $300. buy.com sells the 9000 (for AGP slot) for $155.
Hoping for fixes of ATI products. This depends crucially on whether the product is sold retail by ATI, or ATI is merely the OEM (orginal equipment manufacturer) and it's actually sold by Apple. ATI has been very responsive to bug reports for their retail products (see table below), and we anticipate that nearly all bugs will be fixed by the end of 2002. Unfortunately, the situation is very different for their OEM products. In that case it is necessary for us to convince Apple that there is a bug and that it matters. Then Apple may request that ATI fix the bug, and, again, it is up to Apple to decide whether to subsequently distribute the fix (e.g. as a loose software update, or folded into the next OS release). No one expects Apple to release updates for Mac OS 9 software, so the existing bugs in ATI OEM graphics under Mac OS 9 will remain forever. That includes all ATI graphics in PowerBooks and iBooks. The ATI retail cards are: Radeon 7000 and 8500, which are still sold, and the 7200 pci and agp (aka RADEON pci and agp), which are no longer sold. The Radeon 7500, mobility 7500, and 9000 are all OEM.
Wait for blanking. Doug Taylor has spent some time figuring out the SetClut behavior of the ATI drivers. They respond to the cscSetClutBehavior call, which specifies whether the SetClut should be performed immediately or postponed until blanking. When that is set to zero, the ATI cards immediately load the CLUT and return. When cscSetClutBehavior is set to 1, and you ask the driver to set the CLUT, the driver waits until blanking, sets the CLUT, and then returns. We like that wait because it provides an easy way to synchronize our programs to blanking.
Priority dipping. Graphics drivers are designed to run at priority zero, but we find it useful to run them at raised priority (up to 7) to minimize interrupts. Some drivers are unaffected by this, but the current ATI drivers have trouble operating at raised priority. Fortunately Bob Dougherty's priority dipping trick allows us to get the behavior we need. We call the driver at raised priority (>1) and, when the driver returns, momentarily drop the priority (to 0 or 1), before taking it back up. (3 July 2002)
Testing CopyBits speed (MB/s). Today, visual psychophysics experiments are usually movies, with an arbitrary new image on each frame. How big a movie you can show depends on the pixelSize, the frame rate, and how fast CopyBits can transfer from your offscreen window to your screen. This is measured and reported by ScreenTest.
Testing accuracy (bits). We have taken two approaches: GetClut and luminance tests. GetClut (if it works correctly) tells us what numbers have been loaded into the CLUT, to be sent to the DAC. The luminance tests confirm that the final stimulus is what we expect. When available, GetClut has nearly always turned out to be right. (The only exception is the Radeon 7500 Mobility, which GetClut reports as 8-bit but seems to actually deliver 10-bits through each DAC.) ScreenTest, ClutTest, and LoadClutTest all do thorough GetClut tests, and give a passing grade in 10-bit mode only to the Radeon 8500. (These tests have been made more rigorous in release 2.52.) Doug Taylor and Keith Schneider have confirmed 10-bit performance of the Radeon 7000 and 8500 using visual and photometric tests. It would be difficult for their tests to detect the small errors of the 7000. Doug Taylor's visual and photometric tests confirm that with its current driver, his Radeon 7500 attains only 8-bit performance, which the GetClut tests had indicated, but he hasn't yet tried the latest Apple driver. Chris Chase has performed the same tests on his Radeon 7500 Mobility (built-into his PowerBook) and finds that it passes both visual and photometric tests, though it fails the tests based on GetClut.
Also see: Ben Singer's ATI Radeon page has technical info about the 10-bit DACs. Driver updates from ATI. Updates from Apple: 120113. Here is a newsgroup link for the ATI drivers.
http://bbs.xlr8yourmac.com/ubb/Forum24/HTML/000205.html
ATI
Radeon 9200 PCI card.
13 July 2006. engel
at psych.ucla.edu |
Driver
.Display_DualHead version 1.0.1f58 |
8-bit
accuracy. |
Comments. Works
fine if you're satisfied with 8-bit accuracy. All software tests suggest
10-bit DAC support, but measurements and visual observation of luminance
indicate only 8-bit DAC support.
CopyWindow (ie CopyBits) 86 88 88 MB/s
CopyWindow (ie CopyBits) VRAM 1539 1520 1524 MB/s
Power Mac G4/400, Mac OS 9.2.2 ************************************
G4, 400 MHz, memory bus 100 MHz, 63.542 Mflop/s
*** Screen 0 *************************************************************
"ATY,Bugsy_A" (.Display_DualHead version 1.0.1f58) in slot
SLOT-C
10 bit dacs. 1152x870 75 Hz. (56,60,65,67,70,72,73,75,76,85,90,100,120,150,160,200
Hz avail) |
ATI Radeon 7000 PCI card (Mac Edition). This is an ATI retail product.
|
Driver .Display_DualHead |
10-bit accuracy. |
Comments.
We recommend this card for applications where speed is not a concern.
12/02. ATI has posted a free ROM updater on their web site that fixes the CLUT problems, attaining full 10-bit-accurate performance with the Radeon 7000. Yay! (Thanks to Doug Taylor.)
As suggested by the driver name, "DualHead", it can drive two monitors at once, dividing the graphics memory between them.
Needs priority dipping to wait for blanking at high priority.
The CopyBits speed of the 7000 is remarkably slow and depends on odd details. ATI has acknowledged the problem but hasn't committed to fixing it. The CopyBits rate, measured by ScreenTest, ranges from 13 to 80 MB/s. Experiments by Doug Taylor and Denis Pelli, including some suggested by Vladimir Velenta (engineer at ATI), show that, with one card installed, the CopyBits rate was reasonable (45 MB/s on Denis's G3/300, 80 MB/s on Doug's QuickSilver G4/800) with the November 2001 ATI software. Beyond that, things get complicated. Doug attains the same CopyBits rate with the July 2002 update provided he uses the July 2002's "ATI" menu to turn off "Graphics acceleration". Denis gets a much lower rate (25 MB/s on G3/300) with the July 2002 update, with or without "acceleration". With the July 2002 update, Doug gets 82 MB/s without "acceleration", and 18 MB/s with "acceleration" on his G4/800. Doug notes that turning off graphics acceleration helped CopyBits, but "things like window dragging and scrolling are really slow now." The slowdown is not due the the driver itself. You can use the "ATI ROM Xtender" file from the July update to use the latest driver (version 1.0f31) with the November 2001 inits, retaining full CopyBits speed.
For correct gamma-table lookup, set lower 8 bits of SetClut values to duplicate the upper 8 bits. |
| ATI CD-ROM installed in Mac OS 9.2.2 (Nov. 2001) |
version 1.0f24 |
|
Ok. CopyBits 45 MB/s on G3/300; 80 MB/s on G4/800. With two identical cards installed, CopyBits 18 MB/s in PowerMac G4/800. |
March 2002 Update
Driver updates from ATI. |
version 1.0f26 |
|
Fair. |
June 2002 Update
Driver updates from ATI. |
version 1.0f28 |
|
Fair. With two identical cards installed, CopyBits 13 MB/s in one, and 32 MB/s in the other. (PowerMac G4/800) |
July 2002 Update
Driver updates from ATI. |
version 1.0f31 |
|
Fair. Use the ATI menu to turn off "Graphics acceleration" to greatly increase CopyBits speed. |
ATI Radeon 7200 PCI card (Mac Edition) aka "Radeon Mac Edition (PCI)". This is an ATI retail product, so a clut fix is likely. |
Driver |
8-bit accuracy. |
Comments. Needs priority dipping to synch at high priority.
Tony Jack reports: cursor occasionally leaves behind a small block in the wrong background color, and that the problem was unaffected by upgrading driver and ROM. |
| Mac OS 9.1 |
.Display_Rage128 version 1.0b25 |
|
Poor. CopyBits 20 MB/s. Does not support 10-bit DAC.
|
ATI Radeon Driver 1.1.1 (Jan 2001)
ATI Radeon ROM Update (Sep 2001) |
.Display_RADEON version 1.0f52 |
|
Fair. CopyBits 83 MB/s. Supports 10-bit DACs, but driver bugs (errors of up to 3) limit accuracy to 8 bits. Reported by Zing Lee. Forum 1509. |
July 2002 Retail Update
Driver updates from ATI. |
.Display_RADEON version 1.0f59 |
|
Fair. CopyBits 36 MB/s. Supports 10-bit DACs, but driver bugs (errors of up to 3) limit accuracy to 8 bits. |
ATI Radeon 7500. This is an ATI OEM product, so Mac OS 9 fixes are extremely unlikely. |
Driver .Display_DualHead |
8-bit accuracy. |
Comments. Doug Taylor, "I tried a few things to see if the 7500 was really giving 10-bit resolution and it failed all the visual tests I tried. (They worked on the 8500.)" Forum. |
ATI Radeon 7500 Mobility. This is an ATI OEM product, so Mac OS 9 fixes are extremely unlikely. |
Driver .Display_DualHead |
8 or 10? bit accuracy. |
Comments. Built into PowerBook G4/800. Wait for blanking is immune to priority. |
July 2002 Retail Update
Driver updates from ATI. |
version 1.0b76 |
|
10 bits?. Bob Dougherty and Chris Chase report that the driver supports 10-bit DACs. It fails tests (ScreenTest, ClutTest, etc.) based on GetClut, but it passes simple visual and photometric tests for 10-bit resolution. In 10-bit mode, in the value returned by GetClut, the upper 8 bits are right, and the low 2 bits are a copy of the top 2 bits. CopyBits 186 MB/s. Forum. Like the 9000 Mobility, it may in fact output the correct 10-bit voltages, but we won't know for sure until more thorough tests are made, ie reading every output voltage of each DAC. |
ATI Radeon 8500 AGP card (Mac Edition). This is an ATI retail product, and its former clut problems have already been fixed. |
Driver .Display_DualHead |
10-bit accuracy. |
Excellent! We recommend this card. |
July 2002 Retail Update
Driver updates from ATI. |
version 1.0f72 |
|
Excellent! Doug Taylor reports: passes ClutTest in 10-bit mode with no errors. CopyBits 183 MB/s. Needs priority dipping to synch at high priority. |
ATI Radeon 9000 (Mobility), built-into Apple's 2002 and 2003 Powerbooks. This is an ATI OEM product, so Mac OS 9 fixes are extremely unlikely. |
|
8 or 10? bit accuracy. |
10 bits? If memory serves, Doug Taylor reported that this passes our 8-bit tests, and fails our 10-bit clut-reading tests. Like the 7500 Mobility, it may in fact output the correct 10-bit voltages, but we won't know for sure until more thorough tests are made, ie reading every output voltage of each DAC. |
ATI Radeon 9000 (AGP card). This is an ATI retail product, so Mac OS 9 fixes are likely, if needed. |
|
? |
$155 (list price $169) from buy.com. Has anyone tested it? |
ATI Radeon 9000 Pro (AGP card). This is an ATI OEM product, so Mac OS 9 fixes are extremely unlikely. We are very happy with it so far. |
|
10-bit accuracy. |
Excellent! We recommend this card. Apple announced (8/13/02) that the new line of PowerMac G4's will ship with this card (or the NVIDIA GeForce4 MX or Ti). Passes our 10 bit tests! (No GetClut in 32-bit pixel mode, but that's not an important limitation.) CopyBits 300 MB/s. SetClut synchs well at all priorities. |
Cambridge Research Systems Ltd new graphics card adapter BITS++ has 14-bit DACs. Mac and Win compatible.
DOME high-resolution grayscale graphics cards have 10-bit DACs. However, our contact at DOME says, "Unfortunately we have discontinued support for the Mac OS quite some time ago. ... our boards stopped working [in Macs] in the later model DOME G4's."
Doug Taylor has spent some time figuring out the SetClut behavior of the NVIDIA cards. They respond to the cscSetClutBehavior call, which specifies whether the SetClut should be performed immediately or postponed until blanking. When that is set to zero, the NVIDIA cards immediately load the CLUT and return, as they should. When cscSetClutBehavior is set to 1, the NVIDIA driver returns immediately, and the card itself loads the CLUT at blanking time. Thus there is no way to ask the NVIDIA driver to wait for blanking. Graphics drivers are designed to run at priority zero, but we find it useful to run them at raised priority (up to 7) to minimize interrupts. Some drivers are unaffected by this, but the current NVIDIA drivers have trouble operating at raised priority. At raised priority, the NVIDIA drivers with version <3.0 return immediately and never load the CLUT. "I tested this by drifting a grating by rotating the CLUT using a C program written with the VideoToolBox. On the NVIDIA card, the grating does not drift at priority > 1." At raised priority, the 3.0 NVIDIA driver waits 0.5 s, then loads the CLUT and returns. Apparently it notices that there's a problem, waits for the problem to clear up, and finally, after 0.5 s, times out, loads the CLUT, and returns. This results in a 2 Hz iteration rate. (3 July 2002)
NVIDIA GeForce |
Driver .Display_NV |
Comments |
Update 1.1.1
From Apple 75115. |
version 1.0 |
Bad. Using the NVIDIA GeForce graphics card built into their PowerMac G4/733 computers, two users report (6/01 and 2/02) that the computers hang if one tries to SetClut while priority is raised. So ScreenTest never ends. Paolo Martini; Emily Grossman. See forum 485, 867, 872. |
Update 2.1.1
From Apple 120038. |
version ? |
|
Update 2.3
Mac OS 9.2.1 includes the NVIDIA 2.3 drivers. |
version 1.1
Use Finder Get Info on "NVIDIA Driver" to get update version. |
|
Update 2.4
Mac OS 9.2.2 includes the NVIDIA 2.4 driver files, which are dated Nov. 15, 2001. [Fearless users can follow Doug's example, and use TomeViewer to extract those files from the Mac OS 9.2.2 update. Doug adds, "If you want to do 3D stuff you must also extract the latest OpenGL drivers."] |
version 1.1
Use Finder Get Info on "NVIDIA Driver" to get update version. |
Good. Doug Taylor notes "Upgrading from NVIDIA 2.3 to 2.4 increased CopyBits (CopyWindows) speed from about 250 to 320 MB/s on a GeForce 2MX and 4MX. Also, VRam GWorlds were finally supported on NVIDIA hardware with 2.4." [Screen OpenOffscreenWindow now supports VRAM and AGP, as new options.]
We've received three ScreenTest reports on this driver. For Doug Taylor and Fei Fei Li, SetClut did wait for blanking with prioritySequence 0/0. For David Brainard, SetClut did not wait for blanking in any mode tested by ScreenTest. We're still investigating. Perhaps there's an init conflict. Further ScreenTest reports would be welcome. psychtoolbox@yahoogroups.com |
Update 3.0
From Apple: 120110 |
version 1.1
Use Finder Get Info on "NVIDIA Driver" to get update version. |
Bad. Doug Taylor says, "A warning to NVIDIA users. I upgraded to the 3.0 drivers and now SetClut at high priority bogs down to 2 Hz. It ran fine with NVIDIA 2.4 drivers." Forum 986, 987, 1017. |
Ben Singer reports (forum) that all the NVIDIA GeForce 4 cards have 10-bit DACs. All three flavors of this card (Ti, MX, and GO) have "Dual, 350 MHz, 10 bit RAMDACs". Apparently this is part of NVIDIA's "nView" feature. However, Doug Taylor reports (forum) that "We have a GeForce4 MX that I tested with TimeVideo, ScreenTest, and Ben's new TestGamma. They all reported 8 bit DACs in Mac OS 9.2.2 and 10.1.3 classic mode. It seems that NVIDIA hasn't yet incorporated 10-bit support in their drivers." Friendly letters to NVIDIA developer relations might help convince them that their customers need 10-bit support. Please cc the forum. Currently (6/11/02) the only way to get a GeForce 4 for a Mac is as a build-to-order option when buying a Mac from Apple.
On the no-longer-sold Village Tronic MacPicasso 540 or 850 graphics card running at 160 Hz, the driver seems to wait for blanking when loading 256 elements to the CLUT, but not when loading 32 or less. This seems to be a disconcerting feature of the MacPicasso driver. ScreenTest has been enhanced to test for and document this odd behavior. (6/11/02) Setting the new Screen Preference MinimumEntriesForSetClutToWaitForBlanking to 256 should bring this driver into the fold, resulting in standard synching behavior. Reported by Matteo Carrandini.

OS9: Bugs in the Psychophysics Toolbox
If you find a bug, please report it to the forum. If possible, please include a minimal-length program that evokes the undesired behavior, and a report from ScreenTest to document your computing environment.
The OS9 version of the Psychophysics Toolbox is more or less bug-free. We think we've fixed all but a few obscure bugs that arise under only unusual machine configurations. Here's a complete list of known bugs, followed by notes
of nonobvious limitations. When bugs are fixed they are removed from this list and added to History.
- Once in a blue moon, when I run practically any Psychtoolbox program that opens and closes a window, I crash into MacsBug, which says I crashed while in "NQDColor2Index". Does this happen to anyone else? It's not reliable. A typical scenario is that, after working for an hour, programming in Matlab and C, I run ScreenTest and it crashes. It's not recoverable, so I have to reboot. ScreenTest then runs fine. The crash can occur in almost any program that uses Screen.mex. After the crash, the MacsBug "StdLog" indicates that Screen.mex was closing a window. No one else has reported it, and it's never happened while running experiments in the lab, so it may depend on something unique about my configuration. I am unable to track it down because I can't reproduce it. Knowing of other instances might help narrow down the necessary conditions. As I noted above, it happens rarely, and apparently only to me. If it happens to you, please type "StdLog" into MacsBug and send the StdLog file to the forum. Denis Pelli 8/11/02. Today (8/19/02) I was pleased to discover a Develop article by Apple's Dave Evans that diagnoses the NQDColor2Index crash: the current device, GetGDevice(), is invalid. So I've added a device validity check to all the places in Screen.mex where we get or set the device. If the device is invalid, the check will print diagnostic information that will probably pin point how the problem arises. This new version of Screen.mex will be part of release 2.53 if the bug is still loose at the time of that release.
- PsychSerial behaves somewhat erratically when priority is raised, eg by Rush. "I am using PsychSerial('DTR') to send some synchronization pulses. With priority raised (one or higher), my initial calls to PsychSerial work OK. But after a display loop with priority raised (about 3 s), a final call to PsychSerial('DTR') does not seem to reliably send a pulse. Bringing priority back to zero fixes that, but after 3 s there are a lot of pending tasks so that the timing of the pulse is erratic. In my case, I can run just fine at priority 0, so this is what I'm doing. My display loop has enough slack not to miss frames even without priority raised." Reported by David Brainard. Forum 1261.
- Screen.mex tries to save the current clut when you open the first window on a screen and restore the clut when you close the last of all your windows on all screens. However, the Mac OS9 operating system makes this very difficult, since one can only get the clut values after transformation by the gamma table, yet to set the clut one must supply the values before that transformation, not to mention the fact that many current graphics drivers fail to support GetClut when pixelSize is greater than 8. Our experience is that even though Screen is only moderately successful in restoring the clut, this is good enough. We can accurately control the presentation of all our experimental stimuli, and when we're done the screen is close enough to normal that we can continue working, and switch to other Mac applications unimpeded. Thus we acknowledge this as a permanent bug, but note that it's benign. Reported by Zing Lee. Forum 1507.
Apple's release notes for Mac OS 9.1 warn that "The Color Manager has been changed so that requests for white and black on 8 bit devices now use the documented requirement that white is the first entry in the palette and black the last entry. This will cause problems if applications have custom palettes which do not have white and black in these required positions." This warning has been added to the help text for Screen 'SetClut' and LoadClut. Based on our experience, our reading of this warning is that the Mac OS cares about the values in the QuickDraw palettes, but does not care about what values may have been surreptitiously stuffed into the hardware CLUT by SetClut.
Apple says Mac OS 9 is "not a real time operating system," but this overlooks the fact that many people do real-time experiments on Macs. The Mac OS and device drivers use interrupts to steal time from your application (e.g. Matlab), which is bad when you are trying to show a movie that keeps up with the frame rate. Rush.mex allows you to run a bit of Matlab code with little or no interruption. See Rush.
Issuing a CD command in Matlab flushes all MEX files. It's a "feature" of Matlab.
It is difficult to keep the cursor hidden (HideCursor) when you run your Matlab code as a script, rather than as a function. If your M file begins with the word FUNCTION and you run the file by name, or by the Cmd-E shortcut then it'll run as a function. If you simply type your code at the command line, or run a file without FUNCTION in line 1, or select its text and hit Enter, then it will run as a script. Matlab treats the two cases quite differently. It compiles the function into m-code (if i remember the name right) and runs it without intervention. The script is run as though you were typing it at the Command line and Matlab intervenes a lot, e.g. causing the cursor to show. Thanks to Thomas Jerde for reporting it. Forum.
Beware of stale caching, especially when installing new files. Several users have already been caught. When you replace files in Matlab's path while Matlab is running, Matlab doesn't know that you've done so. When you run an M file, Matlab first "compiles" it into m-code (or something like that) and then runs it. It saves a copy of that compiled function in memory. This is called caching. This allows Matlab to respond more quickly the next time you run the function because it's already in memory, already compiled. When you replace the source file on disk with a new version the cache is now stale, and should be flushed, but Matlab has no way of knowing this. In my experience, recreating the the paths does not flush the caches, though we think it should. CLEAR ALL usually works, but I'm not sure it always works. Quitting and restarting Matlab does always work. A stale cache can blow your mind. Matlab will run the old cached code from memory, yet, if an error occurs, will produce an error message showing lines from the new M file on your disk. You'll look at the code saying it's impossible, as Matlab complacently asks what is your problem.
OS9: History of changes
Version 2.55, 12 March 2005, available for download.
Incorporated Frans Cornelissen's fix for a bug in AssertMex, described here.
- Deleted Gestalt.m from OS9 Psychtoolbox since it is superfluous to Matlab 5's GESTALT, yet would interfere if the path places the Psychtoolbox ahead of Matlab's toolbox, as reported by Frans Cornelissen.
- Updated help text in Snd.
- Throughout the whole Psychtoolbox, now consistently refer to this version as "OS9". We used to refer to it as the "Mac" version, which has become ambiguous.
Version 2.54, 6 March 2005, available for download.
Incorporated Jochen Laubrock's fix for a bug in NearestResolution described here.
- Improved Ask.m as suggested by Paul Thiem: added an example (and better argument checking) to make it clear that replyFun must be supplied as a string and rectAlign1 as a value.
- Improved GetEchoString: Added defaults for all arguments.
Enhanced SCREEN DrawText to optionally accept a transformation matrix to be applied to the text by Adobe Type Manager (ATM). This allows drawing rotated and skewed text. You can download this pre-release version of Screen.mex now. The enhancement does not affect calls without the new extra argument, so your old Matlab programs will not be affected by this change.
Enhanced the Quest threshold estimation package, making it yet more robust, adding more help text, and providing a simple procedure for estimating beta. Quest works on any computer that runs MATLAB 5 or better. You can download it here as a stuffit or zip archive.
- Updated various routines so that they use old (version 1) or new (version 2) optimization toolbox calls depending on what is installed. This shouldn't affect OS 9 operation (where only version 1 exists), but makes the code compatible with OS X.
- Moved several calibration scripts into PsychCal. The main two are CalibrateMonSpd (does basic calibration) and DumpMondCalSpd (tells what is in a calibration file).
Version 2.53, 2 August 2003, available for download.
Updated PrepareScreen.m and DescribeScreen.m to support the NVIDIA GeForce 4MX, which needs MaxSetClutPriority=1, and the ATI Radeon 9000, which runs perfectly with standard settings.
Three users reported that Screen.mex was giving them a fatal error message "GetDisplayModes error -50". We have enhanced Screen.mex to cope more gracefully with errors from the cscGetNextResolution call, simply providing the shorter list of resolutions that it gets from the Display Manager. We also enhanced Screen 'Preference' 'DriverFlags' to report whether cscGetNextResolution is supported, and DescribeScreenPrefs.m to report this, e.g. in the ScreenTest report. Thanks to Keith Schneider, John Jacobson, and Chris Taylor. Forum 1673.
Enhanced Screen Computer by adding a new field, "runningOnClassic". This is used by PrepareScreen to detect that it's running in the Classic compatibility box (ie emulation of Mac OS 9). In that case, it configures all graphics drivers to have SetClut wait for the blanking interrupt. In our tests so far, none of the new drivers supplied by Apple as part of Classic will wait for blanking as part of SetClut. The new, prerelease Screen.mex is available.
We corrected the help text in LoadClut: "SPEED: LoadClut and SetClut are typically called from within a display loop, so it's important that they be fast. You typically call one or the other once per frame. Frame rate is typically in the range 60 to 120 Hz, so the frame period, from blanking to blanking, will typically be 8 to 17 ms. You'd like the time used by by SetClut/LoadClut to be a negligible fraction of that. LoadClut needs to initialize some tables the first time it's called, and has to recompute those tables whenever pixelSize or bits or fixATIRadeon7000 has changed. The rest of the time, LoadClut is fast. This is confirmed by ClutTimeTest. When SetClut waits for blanking, nearly all the time is spent waiting, whether you call SetClut or LoadClut. When SetClut is set not to wait, then SetClut is typically very quick. Depending on your driver, it may take roughly 0.3 ms and iterate at 3 kHz. 0.3 ms is a negligible fraction of the frame period. Under the same conditions (bits==8 on PowerMac G4/500), LoadClut iterates at nearly 1 kHz, taking a bit more than 1 ms per iteration. This is not quite negligible, but should be tolerable in most applications. We haven't yet timed LoadClut when bits==10." Thanks to David Jones for noting errors in the old text. The new, prerelease LoadClut.mex is available.
Fixed minor bug in Screen OpenOffscreenWindow that caused ScreenTest to fail when running in the Classic environment of Mac OS X. (An unsuccessful attempt to allocate VRAM or AGP memory was misreported as being out of regular memory.) Bug reported by Keith Schneider. The new, prerelease Screen.mex is available.
Fixed crash of Screen OpenOffscreenWindow with screen -1. Reported by Keith Schneider. The new, prerelease Screen.mex is available.
Screen.mex now does a device validity check whenever it gets or sets the current screen device. If the device is invalid, the check will print diagnostic information. We hope this will allow us to track down and eliminate the elusive NQDColor2Index crashing bug. The new, prerelease Screen.mex is available.
Fixed bug in PrepareScreen.m that resulted in wrong setting of the SetClutDuplicates8Bits flag. The new, prerelease PrepareScreen.mex is available.
Enhanced GetChar.mex to also return the address (a small integer) of the input device. Useful when you have multiple keyboards connected at once. Thanks to Tom Busey for donating the C code. Forum 1510. The new, prerelease GetChar.mex is available.
Fixed bug in CopyImage.mex. Grayscale images (MxN) were being interpreted with a color colorTable. Now fixed. Forum 1514. The new, prerelease CopyImage.mex is available.
Enhancements to PsychSerial to include OpenRaw and ReadRaw functions.
Included routines for talking to Bits++ and CRS Colorimenter.
Enhancements to colorimetric calculations and data sets.
Version 2.52, 12 August 2002, available for download.
Enhanced Screen OpenOffscreenWindow to allow the option of storing the offscreen window in VRAM or AGP memory, associated with your graphics card, instead of ordinary computer memory. There is only a limited amount of VRAM and AGP memory available, but, depending on your graphics card, this option can result in very high CopyBits speed to the screen. ScreenTest has been enhanced to measure and report those speeds if AGP or VRAM is available. Be warned that this new feature is still relatively untested and may not yet be ready for your publication-quality experiments. It's provided for evaluation, to see whether it's going to be useful.
PrepareScreen is becoming more and more important. It's called automatically by Screen.mex when you open your first window on a screen, but you may want to call PrepareScreen sooner, so that the screen is prepared while you get ready to open a window. It's ok to call it multiple times, as it sets an internal flag once your screen is prepped and returns immediately on subsequent calls. If in doubt, call PrepareScreen. PrepareScreen now does runtime testing to set BlankingDuration, UseHighGammaBits, and SetClutDuplicates8Bits optimally for each screen. For some (older) drivers it's important to set BlankingDuration long (3 ms) in order to avoid racing when SetClut is used in a tight loop. For some new drivers it's important to set it short (0 ms) in order to avoid delaying the SetClut so much that it introduces tearing in CLUT animations. The new runtime tests make the best setting for each driver. Made many small changes to PrepareScreen and DescribeScreen to detect, identify, and configure the latest ATI graphic card drivers. This enhances 10-bit support.
Added TwoBitFlickerTest.m to visually test the functions of the two least significant bits of any graphics card, but especially those with 10-bit DACs. Inspired by prior efforts of Jack Nachmias, Ben Singer, David Brainard, Bob Dougherty, and Doug Taylor.
Added ClutTimeTest.m to measure and report how long SetClut and LoadClut take in the several different ways you might use them. Based on TimeClut.m by David Jones.
-
Fixed bug in SCREEN 'VideoCard' that was corrupting the cardName if you probed more than one card. The bug was in VideoToolbox routine CardName1 in GDVideo.c.
Enhanced SCREEN 'SetClut' and 'Gamma' to respond to the SetClutCallsWaitBlanking flag in a more useful way. Previously SCREEN waited after doing the SetClut. Now it waits before doing the SetClut. By Apple convention, set Gamma does an implicit SetClut if pixelSize>8. All flags that affect SetClut now also affect the implicit SetClut in the same way.
Fixed minor bugs in LoadClut, ClutTest, SetGammaWaitTest, SetClutWaitTest. This enhances 10-bit support.
Enhanced LoadClutTest and the LoadClut test in ScreenTest to be more rigorous, using random numbers and testing all bits. This enhances 10-bit support.
Fixed a minor bug. SCREEN(whichScreen,'FrameRate',nan) correctly forces the FrameRate to be remeasured. However, it was also causing reevaluation of several parameters that are set up in PrepareScreen, resulting in unexpected side effects. Now fixed, no side effects, except that the remeasurement may change the contents of the CLUT.
At the suggestion of Frans Cornelissen, enhanced PsychSerial to return all NULL characters read from the serial port. Previously PsychSerial filtered out NULL characters.
Merged into PsychSerial Dan Shima's enhancement to accept the optional argument named "expirationSecs" passed with the 'Read' command. ExpirationSecs is a period which PsychSerial waits before returning control to the calling environment. PsychSerial still accepts the optional "timeOutSecs" argument. TimeOutSecs specifies the period that PsychSerial waits only if there is no data available to be read from the port, whereas ExpirationSecs specifies the period that PsychSerial waits regardless of whether there is data to be read. ExpirationSecs is useful when the serial port is read during an animation loop, where the duration of each call to PsychSerial must be limited to less than the frame period.
Version 2.51, 5 July 2002, available for download.
Several users found that the new ScreenTest in release 2.5 produced MATLAB errors on their systems. ScreenTest.m itself seems to be ok, but we have enhanced several related files to better cope with unusual conditions, hopefully curing all the reported errors. Forum
SetClutWaitTest.m, DescribeScreenPrefs.m, IsPopCharProInstalled.m, Screen.mex, OpenScreen.m, CloseScreen.m, LoadClut.m.
In response to Chris Chase's bug report, we've enhancedClutTest.m to be compatible with Mac OS X Classic. Indeed it has revealed a bug in a Classic driver. Forum
-
Added new function PsychtoolboxRoot that returns the path to the Psychtoolbox folder, even if it's been renamed. Also updated all other Psychtoolbox functions to use it. Requested by David Jones: "I am in the habit of installing software with a name that reflects the current version. This helps me keep track of the various versions of software on the many computers we have around the lab. So I installed the new update under the name 'Psychtoolbox 2.50'." The Psychtoolbox now copes with that change, but don't rename internal folders as some of those names are still needed. Forum
Fixed IsPopCharProInstalled to check version of MATLAB and avoid using GESTALT unless we have MATLAB 5.2.1, since earlier versions of GESTALT exit if they do not find what they're looking for. David Jones reported that this bug caused ScreenTest to fail in MATLAB 5.2. As always, we recommend that everyone upgrade to MATLAB 5.2.1. Forum
Enhanced Screen 'VideoCard' to return its values as a struct, including the unadorned card name, to allow DescribeScreen to identify the card by matching its list of known cards, and enhance its print out by including the common commercial name.
Fixed WaitBlankingTest bug reported by Chris Chase, and enhanced handling of the Screen Preference values SetClutWaitsForBlanking and WaitBlankingAlwaysCallsSetClut. Now WaitBlankingAlwaysCallsSetClut will automatically be zeroed anytime SetClutWaitsForBlanking is zeroed. Forum
By popular demand, avoid name conflict by renaming OpenScreen and CloseScreen to PrepareScreen and RestoreScreen, which better describe their functions. Updated all the functions that call them to use the new names. Forum
Fixed HideCursor.mex and Screen.mex to reliably restore visibility of the cursor when they are flushed (or when Screen closes its last window). Instead of calling ShowCursor 256 times, they now call InitCursor. The 255 upper limit on the number-of-times-hidden seems to have been true only of an earlier version of the Mac OS, and not true of Mac OS 9.2.2. Thanks to Thomas Jerde for reporting the bug. Forum.
WrapString breaks long lines of text to fit within a specified line length.
Version 2.5, 25 June 2002, available for download.
-
Screen now calls OpenScreen.m when the first window is opened on a particular screen, and calls CloseScreen.m when the last window (among all screens) is closed. We have moved all our graphics-driver-specific code to this file, from the C code for Screen.mex and Matlab code formerly residing in various M files. This allows quick writing of Matlab code for driver-specific configuration, by anyone, instead of writing in C, slowly, by the Psychtoolbox development team. We anticipate that this will facilitate the testing and customization necessary to cope with the idiosyncrasies of new drivers, and quickly extend the consistent synchronization and clut control that we presently have across currently available graphics cards.
Screen now has a Preference for each graphics driver property that we deal with: DipPriorityAfterSetClut, MaximumSetClutPriority, MinimumSetClutPriority, MinimumEntriesForSetClutToWaitForBlanking, DacBits, UseHighGammaBits, SetClutDuplicates8Bits, BlankingDuration. OpenScreen sets all of them appropriately for known drivers, and may do pretty well for unknown drivers. The three priority-related prefs affect the priority at which SetClut (and the implicit SetClut triggered by SetGamma when pixelSize>8) runs. DacBits is merely retained by Screen; it doesn't affect any operation. UseHighGammaBits causes data to be shifted up before SetGamma and shifted back down after GetGamma. SetClutDuplicates8Bits tells SetClut to copy the upper 8 bits to the lower 8 bits in each color spec entry.
LoadClut is an all-in-one replacement for Screen SetClut and Gamma, with full support for all graphics cards, including those with 8-or-more-bit DACs, e.g. ATI Radeon, Radius ThunderPower, and (soon) CRS Ltd. BITS++. This gives greatly improved resolution over that offered by 8-bit DACs. LoadClut is the significantly enhanced release version of the "TenBitInterface" beta software. Thanks to Ben Singer for providing key parts of the original code, Doug Taylor for several helpful tips, and Rhea Eskew for help in testing.
Enhanced ScreenTest to time SetClut in every known mode (pixelSize, priority sequence, number of CLUT entries), to discover what it takes to get your video driver to wait for blanking. The results are reported in a new, shorter, more readable report. The old warnings, which too often were false alarms, are gone. forum 1069
Added SpriteDemo.m (formerly "TargetDemo"), which animates a moving sprite. It conserves memory.
-
ActiveWire.mex added to PsychHardware to control the ActiveWire parallel I/O device.
Joystick.mex added to PsychHardware to read game controllers.
Attenuator.mex (formerly called "CLUT.mex") added to PsychBeta to support the Pelli-Zhang video attenuator. This is one way to improve the resolution offered by 8-bit DACs.
-
Screen GetGammaList uses low-level calls to the graphics driver to retrieve all its predefined gamma tables. This may help in figuring out what gamma-table resolutions the driver will accept.
Enhanced Screen.mex with a new driver-compatibility control MaximumSetClutPriority, accessible as a Screen Preference for each screen. This value was previously always assumed to be 7, but can now be set to lower values (e.g. 1) to accommodate odd drivers, like the NVIDIA "NVDA,Display-B" (.Display_NV version 1.1) that do SetClut extremely slowly (2 Hz) at high priority. (Thanks to Doug Taylor and Fei Fei Li for providing ScreenTests to the forum.)

Enhanced Screen.mex with a new driver-compatibility control MinimumEntriesForSetClutToWaitForBlanking, accessible as a Screen Preference for each screen. This value was previously always assumed to be 1, but can now be set to higher values (e.g. 256) to accommodate odd drivers, like the Village Tronic MacPicasso, that, at least at high frame rates, only wait if the whole CLUT is loaded.
Thanks to help from an engineer at ATI, we now get near-perfect performance of the $130 ATI Radeon 7000 PCI card, which has 10-bit DACs with full driver support. Enhanced Screen.mex, adding a new driver-compatibility control SetClutDuplicates8Bits, which tells SetClut to copy the top 8 bits of each Colorspec to the lower 8 bits.
Enhanced Screen.mex so that the old driver-compatibility controls MinimumSetClutPriority and DipPriorityAfterSetClut, which formerly affected only SetClut, now apply to SetGamma as well, when pixelSize>8. (When pixelSize>8 the SetGamma call effectively does an implicit SetClut, which seems to have the same synching side effects as an explicit call to SetClut.) This helps LoadClut perform consistently across all pixelSizes. See Screen Preference MinimumSetClutPriority and DipPriorityAfterSetClut.
Enhanced Screen.mex to treat the ATI Radeon (aka "DualHead") graphics driver with 10-bit DACs as a special case, like the Radius Thunder. We don't use the Apple-recommended shortcut of supplying a NULL pointer with cscSetGamma to request an identity gamma table. Instead we always provide a complete table. This works around a bug in the driver. Problem reported by Rhea Eskew; solution suggested by Doug Taylor.
Enhanced Screen 'WaitBlanking' to use priority dipping to work around the ATI Rage 128 and Radeon (aka "DualHead") video driver idiosyncrasy, and expanded the synopsis to better explain the returned value.
-
Enhanced Screen.mex so that all functions that accept a copyMode (CopyWindow, PutImage, and TextMode) now accept 'transparent'. Furthermore, copyMode may be an integer, instead of a string, allowing access to all of Apple's copy modes, which are documented in Inside Mac. Suggested by Keith Schneider.
Screen 'ResolutionQuickly', for experts only, is like 'Resolution' but is implemented as direct calls to the graphics driver, and thus is effectively instantaneous. It's also dangerous, because the Mac OS has no idea that you've done this. This may be useful for synchronizing two displays, by running for a bit at different frame rates to bring the blankings of the two graphics cards into phase.
Sabina Wolfson noted (2/02, forum 876) that the shareware program SwitchRes offered more resolutions than Screen 'Resolutions' and ResolutionTest did. We wrote to Stéphane Madrau, the author of SwitchRes, to ask how he does it. Screen was obtaining the list of available resolutions from the Mac OS Display Manager. Stéphane suggested supplementing this list by using cscGetNextResolution to call the video driver directly, to get a list that includes ALL resolutions. We took his advice and enhanced Screen.mex to now offer all these resolutions to the user's program. Please be careful: some of the extra modes don't work.
Enhanced SetResolution and NearestResolution to accept a res structure instead of a list of parameters.
Enhanced NearestResolution to work with the latest LCD screens. Reported by Frans Cornelissen. Forum. NearestResolution now will ignore frame rate when frame rate information is lacking (ie NaN), which is common for LCD screens (e.g. G4 PowerBook, iBook, etc.). [The underlying problem is that at least some built-in LCD screen drivers (iBook, G4 PowerBook, and probably others) report the frame rate as NaN Hz for all video modes. (I haven't gone back to check Apple's rules; this may qualify as a driver bug.) This value is, in turn, reported by Screen 'Resolution' and 'Resolutions'. You can always get the actual frame rate for the current mode by calling FrameRate, which provides the result of an accurate measurement rather than asking the driver. However, with these drivers there is no way to find out what frame rate a non-current mode would run at, except for switching to that mode and measuring it, eg by calling FrameRate. It is tempting to simply assume that the actual rate is 60 Hz whenever the returned value is NaN, but I can't think of any reason that this should always be true.]
Fixed offscreen color bug in Screen.mex. In October 2000, Erin Harley reported a bug: forum 266, 881, 887. Drawing to offscreen windows referenced to screen 1 was often wrongly colored. This affected Screen drawing operations like DrawLine, DrawText, and FrameRect, but did not affect Screen PutImage or CopyWindow. The new DrawTest.m assesses accuracy of colors produced by most of the drawing functions. [The problem stemmed from the fact that Apple's QuickDraw operations use the color table of the current DEVICE (not the current port). This raised no issues if you were using any onscreen window, or an offscreen window associated with screen 0, which is usually the current device, but became an issue when you used an offscreen window associated with another screen. We've now enhanced a humble C routine called SetWindow to also make the offscreen window's device the current device. That fixed the bug.]
New PeekBlankingTest and FlickerTest and enhanced WaitBlankingTest better assess Screen timing. We are using these to characterize timing problems running in the Mac OS X Classic environment.
Enhanced Screen to work around a bug in Matlab's INPUTDLG and QUESTDLG commands. Reported by Charles Collin. Forum. [There appears to be a bug in Matlab's INPUTDLG and QUESTDLG commands (and probably others). If they are issued while a Screen window is open they make Screen's window the current port when they close. This causes a problem later, when the user's program tries to close Screen's window, because it's against Apple's rules to close the window that is the current port: "??? GDOpenWindow.c 530: GDDisposeWindow can't dispose of window while it's the current port." Screen has been enhanced to work around Matlab's bug. It now checks the current port, saving it when it's good, and restoring it from the last good value when it's bad. This seems to solve the problem with no side effects. Try running OpenDLGCloseTest.]
Added new subfunction: Screen 'FillArc', written by Frans Cornelissen.
Screen TextFont now does nothing if the requested font is not available. Formerly in this case it would set the font to 0, the default system font, which is typically Charcoal.
All Screen functions now accept a one-string list, e.g. {'Helvetica'}, as equivalent to the string itself, e.g. 'Helvetica'. This automatic conversion is convenient and matches the behavior of most Matlab functions.
Rewrote interface to PR650 spectrophotometer to now use the universal SERIAL.mex rather than the old now-obsolete CMETER.mex. Improved logic for setting/checking the PR650's synchronization feature. Added ability to read serial port name from a file. Tested in a limited manner on the Mac, not on Windows.
Added routines XYZToLjg and LjgToXYZ to PsychColorimetric. These convert back and forth between the OSA UCS Ljg coordinates and XYZ (10 degree).
PsychCal: Various changes and improvements to the calibration routines, many of them in an attempt to make them more generally compatible across different graphics cards and platforms. This effort will be ongoing.
Implement a PsychCalLocalData folder that lives outside of toolbox folder. Calibration routines read from and write to this folder if it exists. This makes it easier to update the toolbox without wiping out your calibration files. The folder in the toolbox, PsychCalData, has been renamed PsychCalDemoData.
Enhanced Serial('Write',...) to optionally accept a vector of ascii values as doubles in place of a string. With strings, there was no way to send ASCII 0 (the null character), because it was used to mark the end of the string.
DriftDemo shows a drifting grating. LineDemo shows how to draw anti-aliased lines (no jaggies). DriftDemo.m available now from forum.
GetChar.mex now has a second, optional, output argument that returns the time of the keypress (in ticks, 60.15 Hz) and the state of all the modifier keys then: shift, control, command, option, and mouseButton. Suggested by Daniel Shima.
GetChar.mex now reliably quits whenever it receives a Command-Period keypress. It had been passing the Command-Period as a period ".". The fix was to VideoToolbox routine GetNextEventOrQuit in CommandPeriod.c, so it affects all MEX files that call it, including GetClicks and Screen 'WaitBlanking' .
GetMouse.mex is now specified to return a "buttons" vector with one element per mouse button. Your Mac mouse probably still has only one button, but you may want your programs to run on both Mac and Win computers, and Win mice have several buttons. It's easy to cope with the general case, as shown here.
-

GetMouse.mex no longer supports this obsolete usage: xy = GetMouse([windowPtrOrScreenNumber])
where xy is a 1x2 vector containing the x, y coordinates.

Snd('DefaultRate') returns the default sampling rate in Hz in both Mac and Win versions. This value is platform-dependent, so to make your programs portable, you should either get it in this way and take it into account, or always explicitly set the rate.

MaxPriority('Snd') now works again. Fixed by Harriet Allen. Forum.
MaxPriority now allows high priority 'WaitBlanking' if SetClutDriverWaitsForBlanking.
GetSecsTick returns an estimate of the step size of the GetSecs timebase, as an aid to writing platform-independent code.
- FitWeibTAFC and related functions have better initialization of parameter alpha (when it's not passed explicitly), which should improve convergence of the numerical search routines. Thanks to Duje Tadin for pointing out the need.
FitCumNormYN: Fixed bug that caused execution failures for certain data sets. Thanks to Keith Schneider for identifying the bug and the fix. Forum
- Enhanced Screen 'Computer' to recognize the processor type "G4 altivec" in the latest 2002 Macs. This enhances the DescribeComputer report at the beginning of the ScreenTest report. (The change is implemented in the VideoToolbox routine IdentifyProcessor in Identify.c.)
QT.mex, which creates and shows QuickTime movies, has been renamed Showtime.mex, at the request of A.B.Watson. For a transitional period, calls to "QT" will be redirected to Showtime, so old programs won't break.
Fixed help text in Rect functions to indicate that one should type "help PsychRects" for more information.
PasteImage.mex and CopyImage.mex have been rewritten to be compatible with Screen PutImage and GetImage. They are still called in the same way, but they now accept and return MxNx3 arrays for RGB images, and pixels values are in the range [0 255] instead of the former [0 1].
According to our records, on 1 August 2000, Geoff Loftus reported a problem with PasteImage, but he now can't recall making the report, and neither he nor we can now replicate it, so it seems inaccurate to call it a bug. Just in case, though, we'll retain it here. Work around: PasteImage fails with some, but not all, images copied to the clipboard from Adobe Photoshop. Copying the image from the clipboard into another application (e.g. Microsoft Word) and then from that application to the clipboard seems to fix the problem.
-
Jon Jacobs's "TextEnd" patch fixes the "yLabel" bug in Matlab 5.2.1.
Version 2.44, 7 August 2000, available for download.
IccProfile.mex reads any International Color Consortium (ICC) or ColorSync profile, returning all the useful monitor-calibration information as a single Matlab struct for use in your color-and-gamma-correction software. This allows you to calibrate your monitor by using any of the many commercial software & colorimeter packages that save their results as an ICC Profile.
Fixed bug in Screen.mex. In version 2.43, Screen(-1,'OpenOffscreenWindow'); gave garbage GWorld size, e.g. 26700 x 2524. (No problem unless screenNumber was -1, ie no device.) Reported by Steven Dakin.
Enhanced all Screen Preference functions to ignore an empty argument.
Version 2.43, 10 July 2000, available for download.
Fixed HideMenuBarVT.c in VideoToolbox (used by Screen OpenWindow) to use Apple's new HideMenuBar routine only if Mac OS 9 or later is present, as MenuBarTest.m revealed problems using A