unsigned char * image_data;
int bytes; // size
format:
RGBA , UNSIGNED_BYTE.
(opengl-glGetTexImage()):
如何从这些数据创建fipImage *?
C ++。
unsigned char * image_data;
int w = 1000;
int h = 1000;
此函数写入image_data
glGetTexImage(GL_TEXTURE_2D, 0 , GL_RGBA , GL_UNSIGNED_BYTE , image_data);
我想从image_data
创建fipImagefipImage image;
something like this
image.load(image_data ,w , h);
答案 0 :(得分:2)
您可以通过以下方式从原始像素创建FreeImage对象:
FIBITMAP* Bitmap = FreeImage_Allocate( Width, Height, BitsPP, 0, 0, 0 );
memcpy( FreeImage_GetBits( Bitmap ), image_data, Width * Height * ( BitsPP / 8 ) );