I have a small program which draws a triangle with color and smooth shading, and I am able to rotate it. However, I find it odd that in order to rotate it on 2 axes properly, I need to call the function twice.
If I use these lines:
glRotatef(angle,0.0f,1.0f,1.0f);
angle+=0.5f;
the result is the triangle spinning on the y-axis, but only tilted on the z. If the z is <= the y parameter, the tilt is at a degree of whatever is passed to it. But when I pass a higher number for z than y, then the triangle rotates on the z axis and is tilted on the y.
If I use these line:
glRotatef(angle, 0.0f, 1.0f, 0.0f);
glRotatef(angle, 0.0f, 0.0f, 1.0f);
angle+=0.5f;
the result is the triangle spinning on both axes continuously like I want it too.
I’ve read a few explanations of how glRotatef() works, and it seems to me like I should be able to get it to rotate on both axes with just one call of the function.
I find it odd how the first bit of code causes a rotation and a tilt instead of two rotations, but maybe thats just me.
Any explanation of why it doesn’t work would be greatly appreciated.