View Full Version : glRotatef
08-02-2012, 01:29 PM
I don't quite understand how glRotatef works
the first parameter is the angle and the rest 3 are the axes
how are the axes affected by changing the 3 parameters?
does anyone have a picture to help me understand?
08-02-2012, 03:03 PM
the first parameter is the rotation angle, that's correct. The rest are the x, y and z coordinate of the axis around which you want your objects to rotate. So if you want to rotate around the x axis, you use glRotatef(angle, 1, 0, 0).
You could give more information about what you want to achieve. It's hard to tell what you don't understand.
Maybe you have a look at http://www.opengl.org/sdk/docs/man/xhtml/glRotate.xml for further explanation.
08-02-2012, 11:28 PM
just think of the 3 parameters to be a line from 0,0,0
so you have x=3,y=2,z=4 => so think of a line from 0,0,0 to 3,2,4...
and now you just rotate the amount fo angle around this line ...
if angle is negativ than you just rotate the other way ...
think about: if you spin a ring around your finger it can always only be spined around the axis the finger is repesenting...
its the same with glrotate.
hope that helps
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.