How does zooming, panning and rotating work?

前端 未结 3 1738
醉酒成梦
醉酒成梦 2021-01-18 14:04

Using OpenGL I\'m attempting to draw a primitive map of my campus.

Can anyone explain to me how panning, zooming and rotating is usually implemented?

For exa

3条回答
  •  滥情空心
    2021-01-18 14:15

    Generally there are three steps that are applied whenever you reference any point in 3d space within opengl.

    Given a Local point

    • Local -> World Transform
    • World -> Camera Transform
    • Camera -> Screen Transform (usually a projection. depends on if you're using perspective or orthogonal)

    Each of these transforms is taking your 3d point, and multiplying by a matrix.

    When you are rotating the camera, it is generally changing the world -> camera transform by multiplying the transform matrix by your rotation/pan/zoom affine transformation. Since all of your points are re-rendered each frame, the new matrix gets applied to your points, and it gives the appearance of a rotation.

提交回复
热议问题