well, im a c++ and opengl newbie. i wanna use bitmap-fonts (the ones loaded over an texure). works fine, and now i wanna put this texture into my exe-file...but there i have a problem, i always get an big error, or it wont load the texture...
it works when i change the colors from the bitmap to more then 256 colors...but then the exe will be ~10kb bigger...and i dont want that
void LoadGLTextures()
{
int Status=FALSE;
HBITMAP hBMP;
BITMAP BMP;
glGenTextures(1, &fonttexture[0]);
hBMP=(HBITMAP)LoadImage(hInstance,MAKEINTRESOURCE(IDB_FONT1), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
if (hBMP)
{
Status=TRUE;
GetObject(hBMP,sizeof(hBMP), &BMP);
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
glBindTexture(GL_TEXTURE_2D, fonttexture[0]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, BMP.bmWidth, BMP.bmHeight, 0, GL_BGR_EXT, GL_BITMAP, BMP.bmBits);
DeleteObject(hBMP);
}
return Status;
}
I also tried to load the bitmap with
hBMP=LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_FONT1));
but no difference...
when i use: GetObject(hBMP,sizeof(BMP), &BMP);
it crashes, but it works fine with bitmaps with more then 256 colors...
can any1 help?