gluPerspective() takes the vertical fov, aspect, and near and far view ranges. I want the viewport to always use the same horizontal fov, and adjust the vertical fov so that it isn’t stretched, regardless of the viewport height.
desired horizontal fov=90 degrees
The aspect is the width divided by the height, which is 1024/768=1.33333333. I tried this:
But this gave me a little less than 90 degrees view in the horizontal direction. The only way I could get a perfect 90-degree view in the horizontal direction was like this:
What’s going on here? I noticed that 90.0/1.3333333/1.5=45.0, which might be significant.
Then I tried using glFrustum:
When zoom=1.0, I get a perfect 90-degree fov in the horizontal direction. However, when I try changing zoom to 2.0, for a 45-degree fov, I get a somewhat larger fov in the horizontal direction (approximately 50-60 degrees).