PDA

View Full Version : Rotation



ThinIce
02-20-2002, 03:11 PM
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?

Gavin
02-21-2002, 04:04 AM
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

Furrage
02-21-2002, 09:10 AM
There's similar stuff in another post plus a possible solution. The link is below.
http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/007451.html

ThinIce
02-22-2002, 01:32 PM
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).]

ThinIce
02-23-2002, 09:00 PM
is there a way to do so with gluLookAt();

???? PLEASE HELP!

02-24-2002, 01:09 AM
Take a look at
http://www.cs.concordia.ca/~faculty/grogono/graphex.html

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