I have went through various objects on rotations and the tutorials seem to rotate correctly on the simple object like a cube. I am trying to get my object to rotate around the y-axis of the object , however it seems like it’s rotating around an offset of my object’s y-axis. It’s hard for me to describe. I expect the center of my object to be rotating on point , rather the center of my object is making a circle around another point.
Here’s a snippet of my code.
Thanks in advance
This tells me that the object’s modelling coordinates are not centered to the object’s geometric center. Are you sure that the object coordinates are given correctly during modelling in ur modelling program? You can verify this by looking at the bounding box of your model.
Switch the order of your glTranslatef and your glRotatef - what happens?
I think switching the order of gltranslatef and glRotate will add another offset of (0,0,4) units to rotation. The current order is correct since opengl will apply rotation first (at object’s origin which I think is shifted) and then translation.