# rotate an object

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

glRotated(ang,1.0,1.0,0.0);

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.

Nothing wrong with what you posted.

glRotated( 45., 1., 1., 0. )
and
glRotated( -45., 1., 1., 0. )

should rotate differently. It must be something else.

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:

void Punto::dibujar()
{
glPointSize(2.0);
glBegin(GL_POINTS);
glVertex2f(cx,cy);
glEnd();
glFlush();
}

and i try to rotate it like this:

void Punto::rotar(float ang)
{
glRotatef(25.0f,1.0f,1.0f,0.0f);
}

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.

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)

Thanks, i will try that.

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???

Sorry, problem solved. Thanks for your help.