Jump to content

  • Log In with Google      Sign In   
  • Create Account

[FreeImage] Unable to create FIBITMAP * from memory stream


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1   Members   

100
Like
0Likes
Like

Posted 20 September 2011 - 04:48 PM

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...

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;


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.

#2   Members   

129
Like
0Likes
Like

Posted 22 October 2012 - 12:36 PM

Hi, how did you fix the problem ?

regards,
c-mos




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.