Screen capture with GL

I'm working on screen capture functionality using GL. I can do full screen ok, but what I'd really like to do is grab the pixels from individual windows, even if they're being covered by other windows (in other words, not just a portion of the screen, but portions beneath topmost windows).

Mac OS X's "Grab" utility does this, so I know it's possible. Any advice in this area would be much appreciated.

It's possible for Apple, but there's no publicly documented way to get at the backing store bits maintained by the window manager. You'll have to hack Grab.app to figure out what private APIs to use. For starters:

Code:

nm /Applications/Utilities/Grab.app/Contents/MacOS/Grab | grep _CG

You're on your own reverse engineering the parameter types. And forget about forwards compatibility...