glRotatef and Degrees

Started by
1 comment, last by _the_phantom_ 19 years, 8 months ago
I posted amessage before but I think I should have been more specific, but i had to get off my computer. I am rotating the view in my game by using glRotatef(rotatespeed,0.0f, 1.0f, 0.0f) this makes the player think they are rotating the person they are controlling. Rotate speed is a variable with the value 1.0 . Now every time this person makes the camera spin I increase the variable "angleof" by one or decrease it by one depending on which way they turn, then to move forward I use trigonometry to work out which way they are facing and where to move them to make it look like they are moving forward. This trigonometry does not seem to work so I thought maybe that the way OpenGL spun was not degrees but some other random thing, because I have tried it with degrees and radians. So the question is WHEN ROTATING DOES OPENGL USE DEGREES if so maybe I should try again, coz I might have an error in my code.
fRuPeRt
Advertisement
glRotatef( DEGRE, x, y, z);
Its in degre. 0 to 360
translate first your object, and then rotate it.
dont forget Pushing and poping your matrix ;)
keep in mind that C or C++ trig functions use radians NOT degrees, so if you are using them you'll have to convert from one to the other to make it make sense (either keep in degrees and convert to radians for maths, or keep it all in radians and only convert to degrees when you pass the values to OpenGL)

This topic is closed to new replies.

Advertisement