GLbyte* ReadBmpFile(const char * szFileName, GLint& ImageWidth, GLint& ImageHeight)
{
FILE* pFile;
GLint PixelLength;
GLint weishen;
GLint Height;
GLbyte* PixelData, *PixelData1;
GLint n=0;//如果是24位而且高度是负数的话就可以用到它;
pFile = _fsopen(szFileName, "rb", 64);
if (pFile == 0)
MessageBox(NULL, "文件打开失败", "提示", MB_OK);
fseek(pFile, 18, 0);
fread(&ImageWidth, 4, 1, pFile);
fread(&ImageHeight, 4, 1, pFile);
fseek(pFile, 28, 0);
fread(&weishen, 4, 1, pFile);
Height = ImageHeight;
if (ImageHeight < 0)
{
ImageHeight = -ImageHeight;
}
if (weishen == 32)
{
PixelLength = ImageWidth * 4;