DIB file

Hi all!

About texture mapping, there is one problem with my loading function
Here is my code

void COGLTexture::LoadFromFile(char filename)
{
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1,&ID);
glBindTexture( GL_TEXTURE_2D, ID);
Image = auxDIBImageLoadA( (const char
) filename );
Width = Image->sizeX;
Height = Image->sizeY;
gluBuild2DMipmaps( GL_TEXTURE_2D,
3,
Image->sizeX,
Image->sizeY,
GL_RGB,
GL_UNSIGNED_BYTE,
Image->data);
delete Image;
}

exactly, it is the code from codecolony and it works with sample picture “Tex1.bmp” which is used in codecolony page. when I replace this picture with another one, an error occurred: “Failed to open DIB file floor.bmp”. what could lead to this error? anyone can help me! (I compared properties of 2 pictures and they are completely the same);

oh, I found the solution. I set absolute path for the image and it works. But I can’t understand why we need absolute path for my picture while with sample picture, relative path is enough…vhat is the difference between them?

It should work with relative path as well, just in your case I think the current execution directiory is incorrect.