I'm trying to create an FIBITMAP from an unsigned char array. I have verified that the data is correct by writing it to a file on the harddrive and opening it with an image viewer. However, for some reason I can't get the bitmap to be created. The memory stream is created, but the bitmap comes out null every time. Here's what I'm working with...
[source]unsigned char * CSpriteX::loadImageFile(CFileData *image, IMAGEFILE *imgFile, GLuint &texture)
{
FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(image->getName().c_str());
FIMEMORY * stream = 0;
unsigned char tempRGB;
GLuint tempTex = 0;
GLenum errCode;
bool error = false;
stream = FreeImage_OpenMemory(image->getData());
if(FreeImage_FIFSupportsReading(fif))
imgFile->dib = FreeImage_LoadFromMemory(fif, stream);
if(!imgFile->dib)
return NULL;[/source]
The rest of the function should be unneeded. The type of image->getData() is unsigned char * and returns a pointer to the first element of my image data. imgFile->dib is type FIBITMAP *.
EDIT: Disregard this, I fixed it.