我有一个问题,关于在 opengl 中渲染位图文件(手动):如何从 unsigned char 指针获取数据以便在 glDrawPixels 函数中使用它们?(无符号字符 *bitmap_Image)
class bitmap
{
private:
unsigned long BPP;
unsigned long width;
unsigned long height;
unsigned long size;
unsigned char *bitmap_Image; // how use this member??
unsigned int bps;
public:
bitmap();
~bitmap();
bool Load(const char *filename);
#pragma pack(push,1)
typedef struct
{
WORD bfType;
DWORD bfSize;
DWORD bfReserved;
DWORD bfOffBits;
}BITMAPFILEHEADER;
//BITMAPINFOHEADER
typedef struct
{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
}BITMAPINFOHEADER;
#pragma pack(pop)
BITMAPFILEHEADER FileHeader;
BITMAPINFOHEADER InfoHeader;
};