03-23-2002, 06:21 AM
i wonder if anyone can help me save out the current information contained in the framebuffer to a tga? im using the code below and it works to an extent. i get an image out but its kinda skewd and the colours are all wrong. im guessing its something about the pixel alinment thing but ive got no idea.
glReadBuffer(GL_BACK);
glReadPixels(0, 0, SIZE, SIZE, GL_RGB, GL_FLOAT, fTempImageData);
for(j=0;j<SIZE;j++)
{
for(i=j*SIZE*3;i<j*SIZE*3+SIZE*3;i+=3)
{
ImageData[i]=255*fTempImageData[count+2];
ImageData[i+1]=255*fTempImageData[count+1];
ImageData[i+2]=255*fTempImageData[count];
count+=3;
}
}
FileWrite(filename,SIZE*SIZE*3,SIZE,SIZE);
any help or relevant tutorials would be greatly appreciated.
glReadBuffer(GL_BACK);
glReadPixels(0, 0, SIZE, SIZE, GL_RGB, GL_FLOAT, fTempImageData);
for(j=0;j<SIZE;j++)
{
for(i=j*SIZE*3;i<j*SIZE*3+SIZE*3;i+=3)
{
ImageData[i]=255*fTempImageData[count+2];
ImageData[i+1]=255*fTempImageData[count+1];
ImageData[i+2]=255*fTempImageData[count];
count+=3;
}
}
FileWrite(filename,SIZE*SIZE*3,SIZE,SIZE);
any help or relevant tutorials would be greatly appreciated.