Reading BMP files

Is it possible to read a bmp file and to get from it the graylevel value of each pixel using OpenGL?
Thanks

Sure! www.wotsit.org and you’ll find info & source about all (ALL) the file formats known in the universe.

You do it in C/C++ and then you can use it in opengl…
Fuzz

[This message has been edited by Teofuzz (edited 01-18-2001).]

graylevel value of each pixel using OpenGL?

I do not understand what you mean.How to count the socalled graylevel?
So, A RGB pixel (25,34,77) <—its graylevel value is ???

Well, the brightness of a pixel was somewhat like 0.3r+0.5g+0.2*b. Anyway, that were more exact constants in the formula. As you can see, that already represents a value between 0 and 1. There was some graylevel texture format in opengl I think. Anyway, take the brightness and use it a r,g and b in the texture. Will waste a lot of memory but will work…

try 0.3 * red + 0.59 * green + 0.11 * blue

Declare pointer on AUX_RGBImageRec.
The AUX_RGBImageRec is struct of
|GLint sizeX,sizeY| and |unsigned char *data|.On load bitmap use auxDIBImageLoad.
For example :
AUX_RGBImageRec *bmp=auxDIBImageLoad(“E:/Stone01.bmp”);

On draw (or as texture)it use glDrawPixels(bmp->sizeX,bmp->sizeY,GL_RGB,GL_UNSIGNED_BYTE,bmp->data)

That’s it spak!