Framebuffer scaling before calling glReadPixels

Hi

I’m working on an old project with minimum documentation and very restricted source access. The case is:

I have a physical display with a resolution of 480*480.

In the source code, the window is initialized with w = 680, h = 486 using:

window = XCreateSimpleWindow((Display*) pDisplay,
      DefaultRootWindow((Display*)pDisplay), 0, 0, 640,
      486, 0, 0, 0); 

(Xserver from SeaWind, OpenGL lib).

Furthermore the glOrtho is called with following params:

glOrtho(-22, 513, 530, -17, -1.0, 1.0); //Adjust "zoom"

This setup has been working for years…

The think is, a new feature has to be added where the framebuffer pixeldata is read and transfered elsewhere in the system.

To do this I am using glReadPixels (viewport w=680,h=486) and I get the rectangular pixeldata as expected.

My problem is, I would like to get the pixeldata so it reflects the squared view of the physical display and not the rectangular view!
If somehow it would be possible to scale the pixeldata in the Framebuffer before using glReadPixels?

Any help or comments are very much appreciated.

PS. I´m new to OpenGL and I cannot explain why the window initialization is so, other than it is working that way…