在固定点OpenGL上旋转

时间:2011-12-02 17:19:06

标签: opengl

我想模拟一个胸部开口,它由两个主要部分组成,盖子和底座。

为了在x轴上旋转,我是否需要将盖子移动到原点,以便: a)盖子的任何一角都在(0,0,0)或; b)盖子的中心必须在原点上?

所以我的代码看起来像这样:

- draw the chest base
- translate to origin
- rotate
- translate to original position
- draw the lid

1 个答案:

答案 0 :(得分:4)

您应该放置盖子,使其轴心点位于原点上。 枢轴点是它旋转的点,在这种情况下它将是盖子的铰链。

关于代码的顺序:

- draw the chest base
- translate so pivot point of lid is on origin
- rotate
- draw the lid
- translate and rotate to original position