Re: [info-performer] How to save screen to bmp file ?

Date view Thread view Subject view Author view

From: Allan Schaffer (allan++at++sgi.com)
Date: 06/19/2003 08:20:34


Hello Jaemoon,

Jaemoon Yoon wrote:
> Now, I have a problem about saving the screen to bmp files.
> I have frequently used "glReadPixel()" for saving the screen in own my
> OpenGL applications.
> After reading framebuffer, I save the data into bmp files.
> So, I tried that method at this time, but I get the incorrect image,
> which has a right shape and size, but its colors are ruined.

My first guess is that the pixel format used in the readback from
glReadPixel might need to be changed before writing it to a file.
Perhaps glReadPixel returns RGBA and the BMP wants ABGR; or perhaps
there is an endianness problem to solve for each component.

> I inserted saving routines into post-draw callback function.
> If there are any hints or ideas, please let me know !!!
> (Saving the screen into rgb file format by "pfuSaveImage()" works well.)

Good :-)
Also if it's something you only need to do once (instead of every
frame), don't forget you can press (Shift) (PrintScrn), and then paste
the result into an image editor e.g. Paint, MS Image Editor, MS Word, or
etc..

Allan

-- 
Allan Schaffer                                            allan++at++sgi.com
Engr. Manager, Core Rendering                            1-650-933-2160
Silicon Graphics                                     http://www.sgi.com


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Jun 19 2003 - 08:18:23 PDT