saving image as bmp or jpg

If I want to save the image of my scene as a bmp or jpg how do I do that?

Well, I think that there is no better way than using glReadPixels for the entire screen (very slow!). Then swap the R and the B component of every pixel and save the entire buffer in a file adding a BMP header (look at a BMP file with an hexadecimal editor to see how the header looks like).
If you want to save the image as a JPEG file, you can use the Intel JPEG library that you can download from Intel’s web site.

Using Intel JPEG library will I be able to save and open the image within my application? I’ve had a look but I’m not quite sure


Yes, that’s it,
the library enables you to:
open a JPEG image and get a DIB in a buffer in RAM (then you manipulate that like any other bitmap),
recreate a JPEG file from a buffer containing a DIB.

Nice .

Yoy might want to look at OpenIL ( ) It allows you to open and save almost all pictures file types and is as the name suggests very similar sintax to OpenGL. It hass good support for OGL and has fucntions to to bind the textures. It is also OS independant. Saying this I have never got it to work ( I have barely tried actualy), also I haven’t had much of a use.

ive used it a bit.
a problem i had was u had to bind textures twice
once for openil and then once for opengl but apart from that its been pretty sweet. it handles practically all image formats (except for gif) pretty well.

do I use openil the same way as opengl? and is it a set of functions just like opengl?