Opengl resize format

I saw that in every ogl app, when I resize the ogl window on the Y axis, the objects are scaling to fit in the viewport and not to be deformed.
It acts like a camera back zoom or like an increase of the fov (wich is the Y angle of the field of view)
But on the X axis, there are not any deformation on the objects, they keep the same size on the viewport.

Do you have any solution to modify these settings ? For exemple, I would like my object to act the same way on X and Y axis. I don’t want any zoom, if I resize my window on Y axis. Is it possible ?


Everything is possible.
The behaviour you described is defined in the program source. If you can have a look at it, you may understand a lot.

Search for glViewport, glFrustum, and other camera related calls.

Have a look at the doc :

And this sample :…viewcvs-markup
When resizing the window on this sample, the cube is distorted, but exactly the same world space is visible.
With glFrustum following the rescale in both X an Y, you will get the behaviour you want.

ok thx a lot

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.