PDA

View Full Version : Updating projection matrix after changing viewport aspect ratio



madmax1
06-03-2014, 12:22 PM
EDIT: Fixed it myself, the image WAS distorted in the first place, it was just hard to recognize by the displayed part of the scene :)

Hey,

I am using GLFW to handle my window together with OpenGL 2.1 and GLSL 1.2 as well as GLM.
My window has an aspect ratio of 4:3. I use an orthographic projection of the form
glm::ortho(-1,+1,-1,1+,0.1,100), which displays my scene undistorted (part of the scene at the bottom/top is clipped though).
However i seem not to understand the interaction between an orthographic projection and my viewport aspect ratio. If i resize my window (to a different aspect ratio) my scene is distorted when using the same orthographic projection as before. If i scale the left/right and bottom/top arguments of my ortho according to the new aspec ratio however, my scene is displayed correctly. Why do i have to rescale it or why didnt i have to scale it in the first place?

Best,
Max