Mirroring an image

Hi!
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
it.

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?

Code:
JSAMPLE * image_buffer=new JSAMPLE[5825003];
glPixelStorei(GL_PACK_ALIGNMENT,1);
glReadPixels(0,0,582,500,GL_RGB,GL_UNSIGNED_BYTE,image_buffer);
glScalef(1,-1,1);
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…

-SirKnight