Grab current desktop/screen as a texture?

Nibbie
Posts: 2
Joined: 2008.12
Post: #1
Howdy

I'm writing a program and I'd like to mess with the a screen capture of whatever if displayed on the screen when the program starts. I need to then use the grab of the screen as an OpenGL texture so I can draw on it, or put it on a polygon or whatever.

So my question is, how do I grab the screen and then make it into a texture? It's something I've done under Windows, but I can't work it out under Mac OS X, altho I'm hoping it's still possible.

Any help would be greatly appreciated!

Rob.
Quote this message in a reply
Moderator
Posts: 439
Joined: 2002.09
Post: #2
Should certainly be possible. Freedom Force (ported by Omni Group) applies an entertaining swirl effect to the desktop image when it starts up. I don't know how they did it though.

For that matter, screen capture utilities also do it. Hmmm...
[5 minutes later]
Here's a method I just came up with: programatically invoke the command line utility "screencapture", sending the image to the clipboard.
http://www.macdevcenter.com/pub/a/mac/20...tml?page=3
Then you'd have to get it from there into a texture.

There's got to be a more direct way, though. Hopefully someone here knows the magic incantation...

Measure twice, cut once, curse three or four times.
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #3
If you're only interested in capturing *your* app's interface into an OpenGL texture, and if your app is Cocoa, you could use this:

http://developer.apple.com/qa/qa2001/qa1325.html
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2008.12
Post: #4
Hmm.. I actually want to get the whole screen, but it's a start.

Just thinking without knowing here, but is there a global NSView which encompases the whole screen? That'd be handy. Smile Or what about making a window the size of the screen thats transparent, then grabbing that? That would work under Windows, but I don't know enough about OS X to be able to say myself. What dya think?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDL. Current music position e40pud 0 2,366 Mar 9, 2010 08:46 AM
Last Post: e40pud
  Has anyone had problems with desktop after quit? mwark 2 2,425 Jan 23, 2010 05:04 PM
Last Post: mwark
  OpenGL full screen mode leaves garbage on screen when exiting app Malarkey 5 5,409 Nov 19, 2008 12:51 PM
Last Post: Malarkey
  Full screen context doesn't remain the current context Malarkey 3 3,653 Feb 1, 2007 05:27 PM
Last Post: OneSadCookie
  Getting Current Translation And Rotation In OpenGL Nick 3 3,720 Jul 26, 2006 11:16 AM
Last Post: kelvin