please tell how to convert the output image
into jpg file.
You can get the actual image by using glReadPixels to read the framebuffer(color buffer) pixels.Then you can use a library(like libjpeg) to write that to an image file.
Originally posted by zen:
You can get the actual image by using glReadPixels to read the framebuffer(color buffer) pixels.Then you can use a library(like libjpeg) to write that to an image file.
please can u explain it further how to use the libjpeg in conerting the glReadPixels
into image
I don’t know the details as I’ve never use libjpeg before.But I assume that libjpeg has some functions to save image data to jpeg files.You can get that image data with glReadPixels.For example:
unsigned char *p;
p = (unsigned char *) malloc(w * h * 3);
glReadPixels(0, 0, 640, 480, GL_RGB, GL_UNSIGNED_BYTE, p);
This should allocate enough memory and dump the contents of your window in 24bpp RGB format.Read the docs of libjpeg to find out how to save that to a jpg file.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.