Page 1 of 1

Save OpenGL Buffer as image?

Posted: Mon Nov 23, 2009 1:22 pm
by dandymcgee
Anyone know the easiest way to save the OpenGL screen buffer as an image file? The ultimate goal is to send it to the default printer. I know print screen would work perfectly fine for this, but unfortunately it is not an option. Any help is appreciated.

Thanks. ;)

Re: Save OpenGL Buffer as image?

Posted: Thu Dec 03, 2009 3:01 pm
by dandymcgee
No one has any ideas?

Re: Save OpenGL Buffer as image?

Posted: Thu Dec 03, 2009 6:12 pm
by qpHalcy0n
Create an auxiliary buffer object of an RGBA8 integer format with dimensions matching the window dimensions. When some key is pressed, you need to route the final render target instead of to the back buffer to the new render target. FBO would be best for this. Then you can use a PBO (pixel buffer object) to do an async readback of the buffer into client memory. From there you can take this client buffer, tag a BMP header, and write it out as a BMP.