Mirroring an image

I want to try to mirror an image, but it didn’t work. I used the command
glReadPixels to import the picture in the buffer and now I have to mirror

I tried this with the command glScalef(1,-1,1); but it didn’t work. I have
to refer to the image buffer, right? But how does it work?

JSAMPLE * image_buffer=new JSAMPLE[5825003];
write_JPEG_file (“test.jpg”,100,image_buffer,582,500);
delete image_buffer;

Thanks and a happy new year!

This is a beginner question but I’ll answer anyway. glScalef is a function that applies a scale transformation to the modelview matrix which obviously is multiplied by your vertices as they are processed. You are not (from what I can tell) using any geometry at all so your scaling transform does nothing (nothing to your image that is). To do what you want doesn’t even need OpenGL at all. To flip vertically just swap the first and last rows, second and second to last, third and third to last, etc…