View Full Version : rotate an object
03-24-2002, 08:56 AM
I am trying to rotate an object in two dimensions but i get the same results with angle = 45 and angle =-45. How can i do for rotate it??? my code is
03-24-2002, 09:54 AM
I am afraid you have not given enough information. What you have posted does not relate your problem, since a rotation of 45 degrees is different from one of -45 degrees. There is something else in your code that is wiping out the rotation after it has been done, or preventing the rotation from even occuring.
03-24-2002, 10:52 AM
Nothing wrong with what you posted.
glRotated( 45., 1., 1., 0. )
glRotated( -45., 1., 1., 0. )
should rotate differently. It must be something else.
03-24-2002, 11:10 AM
Im sorry if i was not clear with my question. I am making a work for the college, i must make a class for drawing geometric objects. One of the methods is rotate. I am trying to rotate a point in 2 dimensions. I draw the point like this:
and i try to rotate it like this:
void Punto::rotar(float ang)
but i cant make the point do a complete round to the center (0,0)
I only can rotate it between 0 and 90 degrees. Thanks and sorry for my english.
03-24-2002, 11:39 AM
I believe you are misunderstanding the parameters of glRotate.
The last three parameters are a vector that the rotation goes around. If you want to rotate in the XY plane, then you should rotate around the Z axis: glrotate(ang,0,0,1)
03-24-2002, 11:41 AM
Thanks, i will try that.
03-24-2002, 11:56 AM
Now i am geting a 90 degrees rotation when uses angle = 45. My point original position is (0.5,0.0) and after the rotation with ang = 45 i get the point in (0.0,0.5). Why is that???
03-24-2002, 11:57 AM
Sorry, problem solved. Thanks for your help.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.