PDA

View Full Version : saving image as bmp or jpg



fox
03-07-2001, 06:23 AM
If I want to save the image of my scene as a bmp or jpg how do I do that?

Moz
03-07-2001, 06:49 AM
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.

fox
03-07-2001, 07:04 AM
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

thanx

Moz
03-07-2001, 08:41 AM
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 http://www.opengl.org/discussion_boards/ubb/biggrin.gif.

Tim Stirling
03-07-2001, 09:35 AM
Yoy might want to look at OpenIL ( www.openil.org (http://www.openil.org) ) 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.
TIM

zed
03-07-2001, 11:58 AM
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.

fox
03-08-2001, 05:30 AM
do I use openil the same way as opengl? and is it a set of functions just like opengl?

thanx