PDA

View Full Version : Extracting color buffer from an OpenGL app.



Pyrolistical
07-15-2002, 11:38 AM
Hi ppl,

I wondering if it is possible to get a color buffer from an OpenGL app. i.e. Take a screenshot out of say, Quake 3 while it is running.

I was thinking it should be possible, because the color buffer is there on your computer, I just don't know how to access it.

davepermen
07-15-2002, 12:03 PM
press the printscreenkey.

Pyrolistical
07-15-2002, 02:33 PM
Ok, I mean to have a program do this automatically.

jra101
07-15-2002, 03:45 PM
You could try using FindWindow to locate the Quake3 window, then use GetWindowDC to get the applications device context using the HWND returned by FindWindow, then use wglGetCurrentContext to get the rendering context for that window.

Finally, you should be able to use glReadPixels to capture the contents of the OpenGL context.

No idea if this will actually work, haven't tried it myself http://www.opengl.org/discussion_boards/ubb/smile.gif

zeckensack
07-15-2002, 04:58 PM
Quake3?
Why don't you just press F11?

For your own stuff, use glReadPixels.

Pyrolistical
07-15-2002, 06:05 PM
thanks jra101


well, zeckensack, I'm using Quake 3 as an example. I want to be able to do this for any OpenGL App.