The bitmap header (in wingdi.h)
typedef struct tagBITMAPFILEHEADER
{
WORD bfType;
DWORD bfSize;
WORD bfReserved1;
WORD bfReserved2;
DWORD bfOffBits;
} BITMAPFILEHEADER;
//Normally comes next
typedef struct BITMAPINFOHEADER
{
DWORD biSize;
LONG biWidth; //Width
LONG biHeight; //Height
WORD biPlanes;
WORD biBitCount; // Colour resolution ( 16 = 16 bit, 24 = 24 bit )
DWORD biCompression; // Type of compression used
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER;
Your going to have to do a bit more research on the BMP formats to work out
the differn't types of compression methods with the differn't amount of
colours.
Anyway one format, 24 bit with compression = BI_RGB (no compression) is very
easy. Following the header there's just a list of 3 bytes (RGB) for each
pixel in the map. So thats 3 x biWidth x biHeight.
Anyway there's no way to extract a single pixel without reading alot of the
header stuff in the BMP.
Note that this is an openGL newgroup and this question doesn't seem to
related. You should use comp.graphics.api.algorithms for graphics only
related questions.
"matthew.green5" <matthew...@ntlworld.com> wrote in message
news:D_JU8.346$wo5....@newsfep2-win.server.ntli.net...
I wasn't to sure about this. I'm using opengl, and the instructions for
loading and displaying bitmaps were in the book 'Opengl Game Programming'.
I wasn't sure if the load bitmap stuff was opengl specific or general win32.
It is within the bounds of opengl that I wish to use this.
Then if your loading a BMP to a texture use glTexImage2D and simply put the
24-bit map in with the parms.
void glTexImage2D( GL_TEXTURE_2D, 1, 3, Width, Height, 0, GL_RGB, GL_BYTE,
pixelsArray );
Should do it. Note also you need all the other texturing code that should be
in that book.
If you want to draw directly to the screen use glDrawPixels.