OpenGL rotating a camera around a point

后端 未结 4 2120
别那么骄傲
别那么骄傲 2020-12-13 06:52

In OpenGL I\'m trying to rotate a camera around a point, with camera being distance r from the point and facing the point when it rotates. In other words, I want the camera

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 07:22

    You need to either:

    • rotate the camera around the origin and then translate it (*)

    or:

    • use gluLookAt to keep the camera pointing at the center of the circle

    (*) rotation functions normally rotate about the origin. To rotate around another point P you have to:

    • translate(-P)
    • rotate
    • translate(P)

提交回复
热议问题