Aspect Ratio Stretching in OpenGL

后端 未结 2 748
南笙
南笙 2021-01-03 11:46

I am having some trouble with full screen mode. I can set my window to be 800x600, but when I full screen that resolution, it stretches. I assume this is because of a change

2条回答
  •  既然无缘
    2021-01-03 12:02

    After resizing the window, you need to adjust your projection matrix to reflect the new aspect ratio. If you're using classic OpenGL, switch the matrix mode to GL_PROJECTION, load the identity matrix, then call glOrtho or gluPerspective with the vertical dimension scaled by the aspect ratio (assuming you want the horizontal spread of the image to be the same as it was with the original window).

提交回复
热议问题