[英]OpenGl: glRotatef mechanism & how to rotate square around itself without moving
I have problem understanding the mechanism of glrotatef or how does it work, after doing some research I found out that it consists it takes 4 variables, which are the angle that I use to rotate, 1 or 0 for x axis, 1 or 0 for y axis, and 1 or 0 for z axis. 我在了解glrotatef的机理或其工作原理时遇到问题,经过一些研究,我发现它包含4个变量,分别是我旋转的角度,x轴为1或0,x轴为1或0。 y轴,z轴为1或0。
answering of the following questions will help me understanding the glrotatef 回答以下问题将有助于我理解glrotatef
the questions are 问题是
Before reading the answers of question, I suggest you to read how translate/rotate/scale is done with model matrix 在阅读问题的答案之前,我建议您阅读如何使用模型矩阵进行平移/旋转/缩放
When you need to transform your object, you simply perform operation for each vertex that your object has. 当需要变换对象时,只需对对象具有的每个顶点执行操作。
P = [x,y,z,1] -- your point in 3D P = [x,y,z,1]-您在3D中的点
M = [..] -- your 4x4 rotation matrix M = [..]-您的4x4 旋转矩阵
M * P -- your rotation operation M * P-您的旋转操作
In the light of references I provide, here are the very simplified answers : 根据我提供的参考,这是非常简单的答案:
M1 = your 60 degree rotation matrix M1 =您的60度旋转矩阵
M2 = your 30 degree rotation matrix M2 =您的30度旋转矩阵
M1 = M2 * M2 => M1 * P = M2 * M2 * P M1 = M2 * M2 => M1 * P = M2 * M2 * P
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.