Original Post
//SOLVED// I have been troubled with this opengl/C++ issue for sometime and I could use some help. I was able to get started on one a function to import and use bitmaps. I spent a week trying to find info on such a subject and very little seem helpful. I know that to import a bitmap into a program (C++,windows, opengl) you first need to tell the program to open the file, then gather info from it, then convert it to bytes so it can be used. That data is then bind to the program for further use. My issue is this: I've been having issues with the whole converting to bytes part of the process. I believe that the importing and opengl parts are correct but I know that the BYTE part is incomplete and I dont know where to go next. I temporarily put texture_obj in glTexImage2d as the last argument, I know that the byte info should go there not this. Any tips or advise? I am really stumped and could use some help. Just looking for a simple way of importing and using .bmp files in a opengl application. Thanks EDIT revised code: [Edited by - snowfell on August 13, 2008 7:59:35 PM]
bool ImportBMP(char *filename, int num_list)
{
AUX_RGBImageRec * Tx=auxDIBImageLoad(filename);
if (!Tx)
{
return false;
}
glGenTextures(1,&texture_lib[num_list]);
glBindTexture(GL_TEXTURE_2D,texture_lib[num_list]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D, 0, 3, Tx->sizeX, Tx->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, Tx->data);
if (Tx)
{
if (Tx->data)
{
free(Tx->data);
}
free(Tx);
}
return true;
}