-
loading bitmaps from resources in VC++
I'm trying to load my textures from bitmaps I put in my resources and I'm having trouble. I'm trying the following:
CBitmap Bitmap;
LPVOID lpBitmap;
BITMAP bm;
DWORD dwBitmapSize;
Bitmap.LoadBitmap(IDB_SKY);
Bitmap.SetBitmapDimension(128,128);
Bitmap.GetObject(sizeof(bm), &bm);
dwBitmapSize=bm.bmHeight*bm.bmWidthBytes * bm.bmPlanes;
Bitmap.GetBitmapBits(dwBitmapSize, lpBitmap);
glGenTextures(1, &m_textures[0]);
glBindTexture(GL_TEXTURE_2D, m_textures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, 128, 128, 0, GL_RGB, GL_UNSIGNED_BYTE, lpBitmap);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR_MIPMAP_NEAREST);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 128, 128, GL_RGB, GL_UNSIGNED_BYTE, lpBitmap);
Any tips on what I'm doing wrong?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules