capturing output in OpenGL - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

capturing output in OpenGL

kmyadamkmyadam Posts: 17Member
Hi Guys,

I am capturing an image from the output of an OpenGL program(C programming) in TGA format , and i am also attaching the code and the image captured. Any one of you know , how to capture the same picture in some other format like JPEG or GIF. I heard there are libraries to achieve this , if so How???

[code]



void Screendump(short W, short H)
{

FILE *out = fopen("tga_file.tga", "w");
char pixel_data[3*W*H];
short TGAhead[] = {0, 2, 0, 0, 0, 0, W, H, 24};
glReadBuffer(GL_FRONT);
glReadPixels(20,40, W, H, GL_BGR, GL_UNSIGNED_BYTE, pixel_data);
fwrite(&TGAhead, sizeof(TGAhead), 1, out);
fwrite(pixel_data, 3*W*H, 1, out);
fclose(out);

}
[/code]

Comments

Sign In or Register to comment.