aux bmp structure

I am loading a bitmap with the AUX libary i.e.
AUX_RGBImageRec *image;
image = LoadBMP(“grass2.bmp”)

What I want is to get the color data from the structure so I can use it load a bitmap to use as a height map. I can’t find out any inforamtion on the way the rgb data is stored. Thanks for reading this.

… Programm long and prosper.

It’s stored as, well… RGB data.

For instance, to get the RGB data for a given point in the image you can use a function like so…

void GetColor(AUX_RGBImageRec* pImg, int x, int y, int& r, int& g, int& b)
int nIndex = 3*(pImg->sizeX * y + x);

r = pImg->data[nIndex];
g = pImg->data[nIndex+1];
b = pImg->data[nIndex+2];

I just wrote that up on the fly and haven’t tested it, but it should do what you want.

To get a grayscale value for that you can either average the individual rgb values (the sloppy way) or use the proper rgb->grayscale formula which I don’t remember offhand. (It is basically an average, but gives more weight to one of the r,g, or b values.)

thanks alot, tim