Question

unsigned char * image_data;
int bytes; // size

format:
RGBA , UNSIGNED_BYTE.
(opengl-glGetTexImage()):

How can i create fipImage* from this data?

C++.


unsigned char * image_data;
int w = 1000;
int h = 1000;

this function write to image_data

glGetTexImage(GL_TEXTURE_2D, 0 , GL_RGBA , GL_UNSIGNED_BYTE , image_data);

i want to create fipImage from image_data

fipImage image;
something like this
image.load(image_data ,w , h);
Was it helpful?

Solution

You can create a FreeImage object from your raw pixels the following way:

FIBITMAP* Bitmap = FreeImage_Allocate( Width, Height, BitsPP, 0, 0, 0 );

memcpy( FreeImage_GetBits( Bitmap ), image_data, Width * Height * ( BitsPP / 8 ) );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top