# The Industry's Foundation for High Performance Graphics

1. ## Rotation

I'm working on a 3d Scene, Now becoming a 3d Enviroment scene. I am working on key input.
I have succesfully implemented movement on the means of the Z, and X axis.
Forward
Left/Right
Reverse

But now I want to implement a means of rotating. Rotation on the "Y" Axis.
To set the appearance of "Turning" in a direction. Well, I tried

glRotatef(Z,0.0f,1.0f,0.0f);

where the int "Z" is Increased/Decreased by 0.3f upon the single touch of a button.

Well, it worked kind of. The Rotation works. But the Forward,left,right,reverse keys get mixed up. Along with Rendered objects, (walls and a cylinder to be exact) I am unsure. But is this the correct approach? Or is it a simple mathamatcal and/or OpenGL function misuse error?

2. ## Re: Rotation

Remember that when you rotate you also rotate your coordinate system so future calls are about this rotated coord system. look at push and popmatrix as well as loadidentity.

gav

3. ## Re: Rotation

There's similar stuff in another post plus a possible solution. The link is below.
http://www.opengl.org/discussion_boa...ML/007451.html

4. ## Re: Rotation

Erm, well, I am still a bit confused.

I added that to the drawing of my cylinder. The rotation math works, in the esscence of the cylinder being in the right place.

But when I attempt to add it to my room function. either: A: nothing rotates.
or B: it doesn't work.

if yuo want, you can download a zip of my code. and scroutinize it.

here on my server:
http://12.225.213.131/opengl.zip

[This message has been edited by ThinIce (edited 02-22-2002).]

5. ## Re: Rotation

is there a way to do so with gluLookAt();

6. ## Re: Rotation

Take a look at
http://www.cs.concordia.ca/~faculty/...o/graphex.html

There is also a very well-documented example on the usage of gluLookAt().

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•