#### Archived

This topic is now archived and is closed to further replies.

# rotation in 3d..

This topic is 5998 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

What exactly would I write to slow down the roation of a 3d object, the object I am using is a basic figure made of blocks(just to test out some stuff), and I just was wondering if I could make the rotation slower. If this is an extremely complicated thing, please, just reply telling me it is complicating, because I am just getting around texture mapping now, so I am just between newbie/intermediate, and prob. closer to newbie. Its not really something I need, I am just curios of openGLs capabilites "I''''ve sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do''''Urden

##### Share on other sites

here''s a slow rotation example.

Render() {
...
glTranslatef(0.0f, 0.0f, 0.0f); // whever you need

glPushMatrix(); // save current matrix, work with new one
glRotatef(objectXRot, 1.0f, 0.0f, 0.0f); // rotate x
glRotatef(objectYRot, 0.0f, 1.0f, 0.0f); // rotate y
glRotatef(objectXRot, 0.0f, 0.0f, 1.0f); // rotate z

DrawObjectHere(); // draw object (cube, sphere...)
glPopMatrix(); // i''m done with this matrix! get the old one back

objectXRot += 0.01f; // set new global x,y,z
objectYRot += 0.01f;
objectZRot += 0.01f;
...
}

This would draw whatever your doing with a very slow rotation. Hence the x, y and z increment of only 0.01.

Good luck!
And if there''s a problem with what I said, forgive me. I''m a newbie too! =)

- Mike

##### Share on other sites
I think I understand now. I think though, what I really need to do is make the camera rotate around an object, I figured if I make the object rotate slowly I could probably make a decent newbie matrix effect, lol. The problem is though, I remember reading in my book, something abot once the camera position is declared for the model, it cant change? I dont know maybe its the OpenGL Dreams I have been having, lol, j/k. There has to be a way to do it.

"I''''ve sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do''''Urden

##### Share on other sites
Not true, an OpenGL camera can be rotated in exactly the same way as an OpenGL object. Just change the position of it and set it. It''ll rotate! =)

- Mike

##### Share on other sites
lol.. Thank you very much. I will try it soon, what it is, is I made a boxy robot to practice on, and I wanted to see if I could make him kick, and it was, pretty easy, but then I said to myself " Make him kick, stop, and rotate to make a matrix efect" I did it, it didnt look like the matrix, so I put the rotation in slow mo, and it just tooks longer to not look like the matrix, lol. So, later on today I will try rotating the camera. Thank you!

"I''''ve sparred with creatures from the nine hells themselves... I barely plan on breaking a sweat here, today."~Drizzt Do''''Urden

##### Share on other sites
No problem!
Sounds pretty cool too.
Being a newbie OpenGL''er like yourself I''d like to check it out when you''re done! =)

Send it to me in email if you wish.

- Mike

The important thing to remember when programming is: When you''re 90% complete, there''s still 50% more to go.