FAQ - Backwards Compatibility
Q: Is PTB-3 backwards compatible with PTB-2 (Mac or Win)?
A: Not really. When we started developing PTB-3, we hoped to write it so that earlier PTB programs would run under it without modification. This proved difficult, in part because of real differences in the imaging model that PTB-2 was based on (Apple's QuickDraw was the basis for it) and the OpenGL model, and in part because we did not focus on this as one of our primary goals.
For example, in OpenGL a fundamental concept is buffer switching. The contents of a 'front' buffer are displayed while you issue commands to affect the contents of a 'back' buffer. A single command then flips the role of the two, allowing for quick updating of the entire display. This concept was not part of the PTB-2 imaging model. A consequence of this change is that if you don't insert the flip command (Screen('Flip',...) after your drawing operations, you won't see the result. This change can take a little while to get used to, if you've been programming in PTB-2.
However, if you must use old code written for PTB-2, you can switch PTB-3 into some kind of compatibility mode by adding the following command at the very top of your script:
% Enable compatibility mode to old PTB-2:
Screen('Preference', 'EmulateOldPTB', 1);This will try to emulate PTB-2's drawing model:
* All drawing commands will be directed to the visible screen immediately, without need for the Screen('Flip', ...) command.
* The Screen('WaitBlanking', ...) command gets reenabled to allow synchronization of Matlab to the vertical retrace.
* The Screen('WaitBlanking', ...) command gets reenabled to allow synchronization of Matlab to the vertical retrace.
This allows to run many old PTB-2 scripts without further modifications. However, there may be many subtle differences between drawing commands on PTB-2 and PTB-3, so this approach does not guarantee backwards compatibility.
Although PTB-3 is not backwards compatible, there are many similarities between it and earlier versions. It is not too hard to convert old programs, and the ever-growing set of new demos provides examples.
Some of the comments and help text in PTB-3 explain differences between it and older versions, but at this point we are trying to streamline these in the interests of clarity.