Hi, I am experimenting with the 05-perspective.cpp code in LearnMetalCPP. I have made the window resizable by dragging an edge or corner with the mouse. But this causes the image to distort because the original drawing was square and the aspect set to 1.0. Now I want to compute aspect = width/height to use in simd::float4x4 makePerspective( float fovRadians, float aspect, float znear, float zfar ) in the 05-perspective.cpp app. What is the best way to get width and height, such as from CGSize.width and CGSize.height?
How to compute aspect using metal-cpp
Add a Comment