Hi,
I'm currently loading my openGL textures using the following code:
if (TextureImage[0]=LoadBMP("graphics/chair.bmp"))
{
glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, 128, 128, 0, GL_RGB,
GL_UNSIGNED_BYTE,TextureImage[0]->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteriGL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 128, 128, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
}
This is loading my 128x128 texture properly into memory and I can sucessfully use it later on when I am drawing. The problem is that LoadBMP uses the auxDIBImageLoad function from the glaux library, and it will only load bmps from file, and not from a resource file. Does anyone know how I can correctly put my BMP into memory, and what my two calls to glTexImage2D and gluBuild2DMipmaps would be that would allow me to load from a resource file instead? I want to distribute my executable as a stand-alone package, and not with a bmp directory. |