royshil
01-04-2009, 12:02 PM
Hi guys
I am trying to read the contents of an FBO, but the resulting image is corrupted (see the images).
img_data = (unsigned char*)malloc(width*height*3);
glReadPixels(0,0,width,height, GL_RGB, GL_UNSIGNED_BYTE,img_data);
FILE* f = fopen("tmp.raw","w+");
fwrite(img_data,(width)*(height)*3,1,f);
fclose(f);
Does anyone have a clue what is wrong?
Thanks,
Roy.
result
http://img2.timg.co.il/forums/1_125549087.png
screen framebuffer
http://img2.timg.co.il/forums/1_125549132.png
I am trying to read the contents of an FBO, but the resulting image is corrupted (see the images).
img_data = (unsigned char*)malloc(width*height*3);
glReadPixels(0,0,width,height, GL_RGB, GL_UNSIGNED_BYTE,img_data);
FILE* f = fopen("tmp.raw","w+");
fwrite(img_data,(width)*(height)*3,1,f);
fclose(f);
Does anyone have a clue what is wrong?
Thanks,
Roy.
result
http://img2.timg.co.il/forums/1_125549087.png
screen framebuffer
http://img2.timg.co.il/forums/1_125549132.png