views:

1004

answers:

2

I am trying to rotate a 3D model in both forward (counter-clockwise) and reverse (clockwise) rotation directions in orthographic mode. glRotatef() automatically executes a forward rotation but I cannot get a reverse rotation. I have tried the following methods and none of them give me results:

   //(Provide a negative rotation angle of -1 degree)
    glrotatef(-1.0, 0.0, 1.0, 0.0);

    //(Set a negative axis)
    glrotatef(1.0, 0.0, -1.0, 0.0);

Is this a limitation in OpenGL ES 1.1? How can I get REVERSE (clockwise) rotation in OpenGL ES?

+1  A: 

Try an angle of 359 degrees.

George Phillips
Thank you. This worked -- but, why?
RexOnRoids
Because a rotation of 360 degrees would leave you exactly where you started. 359 degrees is one degree less than a full rotation.
Bob Somers
A: 

Your code is doing the same operation twice. If you had left the angle at -1.0 and inverted the rotation axis, you would be rotating the other way. Or if you left the rotation axis alone and negated the angle, you would also rotate the other way. Instead, you negated the rotation angle and inverted the rotation axis, so you end up doing the same thing twice.

You should also keep in mind your high school geometry, where angles are mod 360. This is why a rotation is 359 degrees is the same as rotating by -1 degrees.

freespace