rotating tire rims of car opengl transformations

前端 未结 3 1543
悲&欢浪女
悲&欢浪女 2021-01-25 02:34

Here is the draw function which draws the parts of the car, in this function car rims is checked and flag is checked, and i need to rotate the tire rim as i move the car. Someth

相关标签:
3条回答
  • 2021-01-25 03:26

    I would highly suggest posting this to the class forum. I don't think TJ would really like to see this, and its very easy to find.

    0 讨论(0)
  • 2021-01-25 03:31

    You're almost certainly applying the rotation and transformation in the wrong order, so that the rim is rotated about some point other than the center of the tire.

    You might try doing the rotation in the MODELVIEW matrix and the translation in the PROJECTION matrix.

    0 讨论(0)
  • 2021-01-25 03:33

    In order to rotate a part about its own center, you need to translate it to the origin, rotate it, and translate it back.

    So your

            glRotatef(45,1,0,0) # rotate 45 deg about x axis (thru the world origin)
    

    needs to be preceded and followed by translations.

    See the accepted answer to this question.

    0 讨论(0)
提交回复
热议问题