Capturing screen problem

When i capture the screen using glReadPixels it works fine for the size of window that opens initially, but if I resize the window at all, I get a diagonal line across the image, the image on the left of which is the right hand edge of the image.

Any ideas on what is causing this would be greatly appreciated.

Thanks,
Steve

Ive narrowed it down a bit. If the width of the screen is divisible by 4 then the image works properly, otherwise it doesnt…is this something im gonna have to live with ?

Thanks,
Steve

Could it be something to do with the alignment of the data? I think the .bmp format specifies that all scanlines end on a 4 byte boundary.

j