Opengl旋转一点
我想在opengl中旋转一个形状,但我想在一点上旋转它。也就是说,我有一个圆柱体,我想旋转它,使它看起来像在底部旋转,并且旋转“大小”增加,直到物体落到地面。我将如何在opengl中进行这种旋转?
I want to rotate a shape in opengl, but I want to rotate it at a point. Namely I have a cylinder and I want to rotate it so it looks like it is spinning at the bottom and the spin 'size' increases until the object falls to the ground. How would I do this kind of rotation in opengl?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以,如果你想围绕 (a,b,c) 旋转,你可以在步骤 1 中平移 (-a,-b,-c),在步骤 1 中平移 (a,b,c) 3.
(顺便说一下,不要害怕操作数。在内部,您所做的只是将变换矩阵乘以三倍,但是变换顶点的管道不知道您执行了多少操作,它仍然只使用最后一场使用矩阵进行变换的魔力。)
So, if you want to rotate around (a,b,c), you would translate (-a,-b,-c) in step 1, and (a,b,c) in step 3.
(Don't be afraid of the number of operations, by the way. Internally all you do is multiply the transform matrix three times, but the pipeline that transforms the vertices is agnostic of how many operations you did, it still only uses the one final matrix. The magic of using a matrix for transformation.)