Original Post
When loading a bitmap from resource I can simply do that this way:
It is no problem to create a OpenGL texture from pTextureImage, but - you guess it - only with a 24 Bit Bitmap.
But I want to use 8 Bit Bitmaps (256 colors) instead.
Has anyone suggestions or maybe some exmples for me?
thanks.
HINSTANCE hInstance = GetModuleHandle(NULL); HANDLE hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE (iResource)); BITMAPINFO bmInfo; if(bmInfo.bmiHeader.biBitCount <= 8) bmInfo.bmiHeader.biBitCount = 8; GetObject(hBitmap, sizeof(BITMAPINFO), &bmInfo); DeleteObject(hBitmap); hBitmap = LoadResource(hInstance, FindResource(hInstance,MAKEINTRESOURCE(iResource), RT_BITMAP)); BYTE* pTextureImage = (BYTE*)LockResource(hBitmap); pTextureImage += sizeof(BITMAPINFO)-1; *iTextureWidth = bmInfo.bmiHeader.biWidth; *iTextureHeight = bmInfo.bmiHeader.biHeight; return pTextureImage; |