I’ve made some progress from my previous post. Now I can get the texture of a sky to load, but the texture is all green with white clouds instead of blue with white clouds. The texture is 256x256. Any help would be greatly appreciated. Here is what I’m doing:
BITMAPINFO* pBitmapInfo = NULL;
HINSTANCE hInst = AfxGetResourceHandle();
HRSRC hRsrc = FindResource(hInst, MAKEINTRESOURCE(IDB_SKY), RT_BITMAP);
ASSERT(hRsrc);
BYTE* lpRsrc = (BYTE*)LoadResource(hInst, hRsrc);
ASSERT(lpRsrc);
pBitmapInfo = (BITMAPINFO *)LockResource(lpRsrc);
if (pBitmapInfo)
{
glGenTextures(1, &m_textures[0]);
glBindTexture(GL_TEXTURE_2D, m_textures[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, 256, 256, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, pBitmapInfo);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_NEAREST);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 256, 256, GL_BGR_EXT, GL_UNSIGNED_BYTE, pBitmapInfo);
}