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.
Save OpenGL Buffer as image?
Moderator: Coders of Rage
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Save OpenGL Buffer as image?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Save OpenGL Buffer as image?
No one has any ideas?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
-
- Respected Programmer
- Posts: 387
- Joined: Fri Dec 19, 2008 3:33 pm
- Location: Dallas
- Contact:
Re: Save OpenGL Buffer as image?
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.