Hey guys.
I have a big problem and I don’t know how to solve this.
I am loading an image file with this function:
bool LoadTexture(const char* filename, GLenum imageFormat, GLint internalFormat, BYTE *imageData)
{
FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
//pointer to the image, once loaded
FIBITMAP *dib(0);
//check the file signature and deduce its format
fif = FreeImage_GetFileType(filename, 0);
//if still unknown, try to guess the file format from the file extension
if(fif == FIF_UNKNOWN)
fif = FreeImage_GetFIFFromFilename(filename);
//if still unkown, return failure
if(fif == FIF_UNKNOWN)
return false;
//check that the plugin has reading capabilities and load the file if(FreeImage_FIFSupportsReading(fif)) dib = FreeImage_Load(fif, filename); //if the image failed to load, return failure if(!dib) return false;
//retrieve the image data imageData = FreeImage_GetBits(dib); //if this somehow one of these failed (they shouldn't), return failure if(imageData == 0) return false;
//Free FreeImage's copy of the data FreeImage_Unload(dib);
//return success return true;
}
When I try to render this Image Data with
glRasterPos2i(50,0);
glDrawPixels(64, 64, GL_RGB, GL_BYTE, iData);
I only see a black rectangle on the screen and I don’t know why. Please can anyone help?