Re: OSX video

>Denis,
>
>I was hoping you could help me with a Mac question. We've been using
>Macs for years for our single unit recording, and I have been trying
>to find out whether we will be able to continue with them under OSX.
>The main issue seem to be whether we will be able to get hold of
>vertical retrace interrupts. I've found virtually nothing on devices
>under OSX, and I was wondering if you could give me some pointers to
>some information.
>
>Thanks,
>John Maunsell
>_________________________________________________________
>John Maunsell 713-798-3273
>Investigator, Howard Hughes Medical Institute 713-798-3282 (fax)
> & Professor of Neuroscience maunsell@...
>Division of Neuroscience, S-603
>Baylor College of Medicine
>One Baylor Plaza
>Houston, TX 77030
>_________________________________________________________

dear john

yes. last fall i queried the apple engineers and determined that there
are calls for this stuff. at that time it was confidential, but it's now
public.

there are two documents to read:

TN 2007 - The CGDirectDisplay
http://developer.apple.com/technotes/tn/tn2007.html

TN 2008 - The CGDirectPalette
http://developer.apple.com/technotes/tn/tn2008.html

and the corresponding header files:

CGDirectDisplay.h
CGDirectPalette.h

also:
QA1011 - How do I use QuickDraw with CGDirect... ?
http://developer.apple.com/qa/qa2001/qa1011.html

i haven't tried any of this, but it looked ok to me at the time.

best

denis

ps. i've cced this to the PsychToolbox forum, since others may be
interested.
ps
> will we be able to continue under OSX? Grabbing vertical retrace
> interrupts is important

OK. while you read this e-mail point your browser at
http://developer.apple.com/samplecode/index.html

There is a brand new synch to VBL sample here, plus OpenGL games code and a
bunch of other stuff to get you going. IMHO, OpenGL IS THE WAY GO.

In addition to that stuff, here is my view of X devt for psychology, based
on what I have learned/garnered/heard from developers, my reading and
attending WWDC 2001.

1. Even though you can do OpenGL and full screen from Cocoa, it is probably
not good enough for our kind of full screen action.

2. Quartz is highly precise (resolution independent, cool axis transform
stuff, anti-aliasing, bezier curves and color synch built in). So this is a
nice environment for generating stimuli and would suit some perception
applications very nicely as a presentation engine, but has too much overhead
for the kinds of rapid stimulus things that we do - too slow.

3. Core Graphics is faster but is probably between two stools: not ultra
easy, not ultra fast.

4. OpenGL is ultra fast and in general is the "The Way To Go" (tm).

The OpenGL guys are working closely with engineers from NVidia and Radeon
Both of these companies understand the need for speed and many of the Apple
guys are writing example code for games dev't under X.

We can load all of our pictures for a trial or even a whole experiment
stored as texture maps in Video RAM (this path is very fast - about than
250MB/sec). Then, to draw an image, you just draw a Rect passing the
"texture" you want it to filled with - viola - your massive picture just got
blasted on screen at better, possibly mathematically transformed at the same
time.

Regarding the retrace. You are in at least as good a position under X as
under 9. Check out the example code. It is not perfect.

Great news: There is a call in Cocoa which supposedly returns you the actual
current pixel line at which the retrace is sitting.

Less than great news: This is apparently not yet guaranteed to work.

OpenGL has a flush command which is guaranteed to be synched to the retrace.
By using this, you can know that your goods are in synch.

Some body smart with 2 or 3 days to devote to this could build a hot VBL
replacement, basically do some flush calls and some timing stuff and synch a
microsecond timer to the retrace so that the very few re-traces which
existing code misses can be compensated in software.

I am just beginning to work on this stuff, and so have not yet had time to
a/ verify the above
b/ translate it into actual API calls and test it all

Note also:the opengl and games lists (subscribe at lists.apple.com or
something similar) have fielded this question previously (search the text
archives of these lists and let us know what you find if you have the time).

Apple engineers monitor these lists are they do care that we psychologists
are able to keep on buying Apple hardware, so pester them as well.

tim
dear tim

thanks for your very helpful post!

best

denis