View Full Version : Heightmap from a BMP file.

06-12-2001, 10:04 PM
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.

06-13-2001, 04:04 AM
Well if it is a greyscale (I assume it is)
unsigned char depth;

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

I have a funny feeling i havn't quite grasped what you were asking....

06-13-2001, 09:43 PM
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.

Tim Stirling
06-13-2001, 11:05 PM
if it is a 24bit texture then average the red,green and blue channels and the code changes slightly.