Rotation -- Vertical Orientation

Hi,
I am trying to rotate a symbol such as “6” around a center screen but I want “6” not turn around and display as “9”.
I used glTranslatef(-5.0f, 5.0f, 0.0f);
glRotatef(rotA, 0.0f, 0.0f, 1.0);
Draw_6();
Thanks.

Did you try glRotatef(rotA, 0.0f, 1.0f, 0.0) ?

Originally posted by moon:
Hi,
I am trying to rotate a symbol such as “6” around a center screen but I want “6” not turn around and display as “9”.
I used glTranslatef(-5.0f, 5.0f, 0.0f);
glRotatef(rotA, 0.0f, 0.0f, 1.0);
Draw_6();
Thanks.

Did you try glRotatef(rotA, 0.0f, 1.0f, 0.0) ?

I did but the symbol just disappear

I could not understand what you exactly trying to do but transformations are done starting from last to first. In your code first rotation around y axis (glrotate(rot, 0.0,1.0,0.0) ) will occur then translation. rotation occus place around origin. if you want to turn your object around its own axis your code should be :
gltranslate
glrotate

if you do:
glrotate(45,0,1,0)
gltranslate(5,0,0)
object first goes to point (5,0,0) then rotates 45 degree around y axis passing thru origin.
If you cannot see your object it might be due to your perspective also.

Originally posted by moon:
I did but the symbol just disappear

Hi,

Try this

glPushMatrix();
glRotatef(rot,0,0,1);
draw6();
glPopMatrix();

How are you drawing the 6?
Is the problem it does not rotate at all?

Originally posted by moon:
Hi,
I am trying to rotate a symbol such as “6” around a center screen but I want “6” not turn around and display as “9”.
I used glTranslatef(-5.0f, 5.0f, 0.0f);
glRotatef(rotA, 0.0f, 0.0f, 1.0);
Draw_6();
Thanks.

First off what is rotA? Is it constant or incrementing number? When you do a rotate what does it look after. I would try this:

glPushMatrix(); // Save the current MV matrix
glLoadIdentity(); //Wipe the MV matrix clean.
glTranslatef(0.0f, 0.0f, -10.0f); // Move it in front of the camera.
glRotatef(180, 1.0f, 0.0f, 0.0f); // flip it over on the x-axis.
glRotatef(180, 0.0f, 1.0f, 0.0f); // flip it over on the y-axis. You will have to do two rotations to get a 6 to look like a 9
Draw_6(); // Draw
glPopMatrix(); // Restore the MV matrix

Try this with the glLoadIdentity() call and see if it works. Then (if it does)take it out and check. If the second way doesnt work then your current model view matrix is rotating your coordinate system and you dont know how its oriented. So when you try to rotate its giving you unexpected results. Another thing is make sure you current matrix mode is model view. If you try doing those rotates in say in the projection matrix mode. Who knows whats going ot happen to that model.

Regards,
Troy