iDevGames Forums
Screenshot of OpenGL context - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Screenshot of OpenGL context (/thread-6413.html)



Screenshot of OpenGL context - aarku - Jul 23, 2004 08:49 AM

In my OpenGL game when I take a screenshot of the entire screen using command-shift-3, or a section of the screen using command-shift-4, things work fine. But when I take a screenshot of the window using command-shift-4 + spacebar, the window is a white screen.

Why is this? What do I need to do to fix it?

I'm guessing it is a similar problem to when you minimize an OpenGL window to the dock and get a white screen. But is there a carbon event I can install for this case that will give me a chance to copy things to the screen?

Why is capturing a window different than a screen/selection?

-Jon


Screenshot of OpenGL context - ThemsAllTook - Jul 23, 2004 09:09 AM

aarku Wrote:Why is capturing a window different than a screen/selection?

Just a guess... Maybe the window capturing mechanism simply copies straight out of the window's PixMap, while the fullscreen/region capture has to use another mechanism to get at the pixels.

What I've seen many OpenGL applications do is implement their own screenshot mechanism with a custom key shortcut, use glReadPixels to get the pixel data, and save that to disk. That's probably the only reliable way to do it, because even with fullscreen capture, tearing can occur.

Alex Diener


Screenshot of OpenGL context - aegidian - Jul 23, 2004 09:09 AM

I don't know, but writing a screenshot from an OpenGL context is a relatively simple task of using glReadPixels to get the data bytes from the screen, arranging them into an NSBitmapImageRep, adding that to an NSImage and then writing out the NSImage.

I could post the code used in Oolite for doing it if you like.


Screenshot of OpenGL context - aarku - Jul 23, 2004 09:34 AM

aegidian Wrote:I don't know, but writing a screenshot from an OpenGL context is a relatively simple task of using glReadPixels to get the data bytes from the screen, arranging them into an NSBitmapImageRep, adding that to an NSImage and then writing out the NSImage.

I could post the code used in Oolite for doing it if you like.

I have my own functions to read the context and write to a GWorld or save to a file, thanks. I'm just trying to get the game behaving with the OS correctly. Command-shift-4 + space doesn't work, and it should.

-Jon


Screenshot of OpenGL context - arekkusu - Jul 23, 2004 11:10 AM

It is broken, and Apple knows about it. Feel free to log another bug on it though.

Minimizing, there is an OS event that you can trap and copy the GL bits to the window backing store. Screen capture, there is no OS event, so there's nothing you can do now. Sorry.


Screenshot of OpenGL context - CarbonX - Jul 23, 2004 03:21 PM

The problem with Command+Shift+4 Space is that the OpenGL context is constantly updating so here's what I do. Just do a Command+Shift+4 and drag a box arround the window (It is still a bit tricky to get the shot) and you will be able to see the frame changes. It may take a few tries (most of the time you just get partially drawn pics) but it's better than pure white right? good luck Wink


Screenshot of OpenGL context - aarku - Jul 23, 2004 07:05 PM

arekkusu Wrote:It is broken, and Apple knows about it. Feel free to log another bug on it though.

Minimizing, there is an OS event that you can trap and copy the GL bits to the window backing store. Screen capture, there is no OS event, so there's nothing you can do now. Sorry.

Thanks, although an unfortunate bug it's good to know it's not my fault!

-Jon