View Full Version : Loading bitmap into Gluint [256 * 256] array
10-25-2000, 02:40 PM
I'm trying to load a bitmap into a 256 x 256 array. I have currently loaded the bitmap into the Visual c++ project as a binary. Do I use the HBITMAP class and some how get a pointer to the binary and iterate it into the array. This is very complicated to me and would like a good example.
10-26-2000, 03:24 AM
Well, I don't have a compiler right here, but the following lines should give you a hint at least.
The function GetDIBits is used for retrieving the raw pixel data from a windows bitmap. All you need is a HDC and a HBITMAP handle
// 1. prepare BITMAPINFOHEADER for GetDIBits
info.biHeight=-256; // we usually want a top-down-bitmap
info.biXPelsPerMeter=10000; // just some value
info.biYPelsPerMeter=10000; // just some value
// 2. let's do it
// 3. Now your array should contain the raw bitmap data
The pointer you've got to supply must point to an array at least 256*256*3 bytes large (*3, cause in the example above you want retrieve RGB data, so 3 byte per pixel are necessary).
Hope it helped (and hope it works - can't test it).
10-28-2000, 06:31 AM
thanks for the help I got it working!
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.