opengl中的旋转
我有一个平面,我想绕 y 轴旋转它。平面坐标位于:
Vec4f(-1,-1, -5, 1),
Vec4f( 1,-1, -5, 1),
Vec4f( 1, 1, -5, 1),
Vec4f(-1, 1, -5, 1),
我只想让平面旋转,而不是绕圈,所以我将其平移回原点 a 然后进行旋转:
glTranslatef(0,0,-5);
glRotatef(50.0*t, 0, 1, 0);
draw(plane);
但平面仍然绕原点转一圈。我做错了什么?
I have a plane and I want to rotate it around the y axis. The planes coordinates are in:
Vec4f(-1,-1, -5, 1),
Vec4f( 1,-1, -5, 1),
Vec4f( 1, 1, -5, 1),
Vec4f(-1, 1, -5, 1),
I just want the plane to rotate, not go around in circles, so I translate it back to origin a then do the rotation:
glTranslatef(0,0,-5);
glRotatef(50.0*t, 0, 1, 0);
draw(plane);
But the plane still makes a circle around the origin. What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
转换以与乘法相反的顺序应用,而且您可能希望转换回它的来源。所以像这样改变它:
Transformations apply in the opposite order in which you multiply them, also you might want to translate back to where it came from. So change it like this: