Jump to content
  • Advertisement
Sign in to follow this  
frupert

OpenGL glRotatef and Degrees

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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 ;)

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!