void CreateResTextures()
{
// bits needed to create a 256x256 24 bits bitmap
const int iNrBits = 256*256*3;
// Load bitmap from resource file
HBITMAP bitmap = LoadBitmap(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDB_BITMAP));
// Allocate bitmap data
unsigned char *data = new unsigned char[iNrBits];
// Get bitmap data from handle
GetBitmapBits(bitmap, iNrBits, data);
// Create one texture
glGenTextures(1, &m_texture[0]);
// Bind name to texture
glBindTexture(GL_TEXTURE_2D, m_texture[0]);
// Generate the texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 256,
0, GL_RGB, GL_UNSIGNED_BYTE, data);
delete data;
}
The pixels in the image is not on correct positions. But I think that all the colors is correct. Only half texture shows up.
Somebody of you must have loaded a bitmap from a resource file and used it as a texture
Gandalf the WhiteEdited by - Gandalf on 6/20/00 7:30:12 AM