I use the following code to load a texture into OpenGL, using DevIL:
bool CImage::Load(const std::string &File){
Clear();
ILuint Image;
ilGenImages(1,&Image);
ilBindImage(Image);
ilLoadImage(File.c_str());
if(ilGetInteger(IL_IMAGE_ORIGIN) == IL_ORIGIN_LOWER_LEFT) iluFlipImage();
Tex = ilutGLBindTexImage();
Width = ilGetInteger(IL_IMAGE_WIDTH);
Height = ilGetInteger(IL_IMAGE_HEIGHT);
int W,H;
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_WIDTH,&W);
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_HEIGHT,&H);
ilDeleteImages(1,&Image);
return Tex != 0;
}
My problem is that after the texture is loaded, it only has a size of 1*1 ie. one pixel, which it 512 times smaller than the actual image.The pixel is the same color as the top left pixel in the actual image, so I know that some of the data is loaded.
If you want you can download the code here, and check it out:
Engine.zip 461.47K
39 downloadsPS: I don't know if this fits in this forum. It kind of has to do with OpenGL, and kind of doesn't.






