From quaternions to OpenGL rotations

前端 未结 2 1513
梦毁少年i
梦毁少年i 2020-12-15 10:55

I have an object which I want to rotate via keys. The object should yaw, pitch and roll. After trying a lot, I figured out that glRotate has its limitations and

2条回答
  •  -上瘾入骨i
    2020-12-15 11:06

    You can easily build rotation matrices out of unit quaternions.

    Given a unit quaternion a + bi + cj + dk, you can build the following 3x3 matrix:

    The matrix

    Add the last line and column taken from the identity 4x4 matrix, glMultMatrix and you're done :)

提交回复
热议问题