glRotatef.... shrinks?

hello, I have a question(obviously)…

In my program I have it so the user can increase/decrase the rotation speed and change the direction of the rotation…

glRotatef(spin_speed, x_rot, y_rot, z_rot);

Here’s my problem… whenever the degree of rotation is set, but the others are at 0.0, the object seems to go off into the distance… so what can I do to fix this, what am I telling it that I’m not supposed to? shouldn’t it just sit there and have no spin if the rotation proportions are 0? thanks

[This message has been edited by Mitchell Hayenga (edited 10-21-2000).]

Well, your choice of variable names tends to make me think you may misunderstand how glRotate works.

You have:

glRotatef(spin_speed, x_rot, y_rot, z_rot);

but what you have as spin_speed is really supposed to be an angle, not the rate at which an angle changes. Also x_rot, y_rot, and z_rot actually form a vector [x_rot y_rot z_rot] that the rotation occurs about.
My guess would be that you are changing one of those terms and end up rotating the object into the distance.

Otherwise you may simply be doing the rotation at the wrong time in the concatenation of the modelview matrix.

Considering what you wrote, I’m not quite sure you know what the three last arguments in glRotatef is. It’s not factors which is multiplied with the angle to tell OpenGL how much to rotate about each axis, but rather it defines a vector to rotate about.

glRotatef(10,1,2,0) doesn’t mean 10 degrees about the X-axis, 20 degrees about the Y-axis and no rotation about the Z-axis. It means 10 degrees about the vector (1,2,0). So if you mean something happens when all three last arguments is zero, I can understand it, because you are trying to rotate about a zero-vector, which got no direction. So basically you are telling OpenGL to rotate # degrees about nothing.

Oooh, I like when two or more people replies at the same time, saying the same thing…

just poor choice for names as an example… I just thought that if I specified whatever degrees(in my case that is like speed because it’s in my idle section, so the greater the degree, the faster it appears to move), without anything else, that it should figure that it isn’t supposed to do anything… ok, looking into it…