• Advertisement
Sign in to follow this  

[FreeImage] Unable to create FIBITMAP * from memory stream

This topic is 1920 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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());

imgFile->dib = FreeImage_LoadFromMemory(fif, stream);

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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement