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!


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???


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};
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);



Sign In or Register to comment.