Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


[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 Oni Sephiroth   Members   -  Reputation: 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.

Sponsor:

#2 c-mos   Members   -  Reputation: 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.



PARTNERS