Heightmap from a BMP file.

I want to create a height map. If I have a bitmap file loaded into memory in the form of image->data,a pointer inside a structure, how would i go about reading the white intensity of each pixel in the image? I dont want to use targa files for my heightmap.

Well if it is a greyscale (I assume it is)
unsigned char depth;

for(y=0;y<height;y++)
for(x=0;x<width;x++)
depth = pointer2struct->data[(y*width) + x];

I have a funny feeling i havn’t quite grasped what you were asking…

Ill try that, looks like it should work, I was expecting it would be something like that but didnt have time to try it out fully. Thanks.

if it is a 24bit texture then average the red,green and blue channels and the code changes slightly.