PDA

View Full Version : Reading BMP files



jose
01-18-2001, 07:28 AM
Is it possible to read a bmp file and to get from it the graylevel value of each pixel using OpenGL?
Thanks

Teofuzz
01-18-2001, 08:27 AM
Sure! www.wotsit.org (http://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).]

Suvcon
01-18-2001, 08:55 AM
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 ???

Michael Steinberg
01-18-2001, 11:38 AM
Well, the brightness of a pixel was somewhat like 0.3*r+0.5*g+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...

spak
01-23-2001, 07:00 PM
try 0.3 * red + 0.59 * green + 0.11 * blue

FoxDie
01-23-2001, 07:59 PM
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)

Michael Steinberg
01-24-2001, 06:20 AM
That's it spak!