jpeg screenshots

ok so I have this libjpeg for reading and writing jpeg images. For anyone familiar with the libjpeg please help. All I need to know is how to take glReadPixels(0, 0, imageWidth, imageHeight, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer) and somehow convert that into the buffer libjpeg uses which is something like JSAMPLE *buffer. I dont think I am using glReadPixels right. Does anyone have a clue how to do this.

so you just want to unpack some jpeg data?

first you will need to create a jpeg_decompress struct and then open the file. Perform jpeg_stdio_src(…), jpeg_read_header(…) then start decompress using jpeg_start_decompress(…).

Setup some scanline ptr’s and use jpeg_read_scanlines to read data … google for sample code!