glPushMatrix();
glColor3f(1.0, 1.0, 0.5);
glScalef(40.0, 2.0, 0.0);
glRotatef( -45.0f, 0.0f, 0.0f,0.0f);
unitSquare();
glPopMatrix();
Animation with scaled and literal pixel objects
I have ran into a problem, I made some objects using scales and now my old method of animation is obsolete. For example I would just have 2 var's set for the left side of a rectangle, which was an arm, and to move the arm up and down I would just increase the value of the arms left side var's. Now since I scaled the objects to size I don't have the option of doing that, I am trying to use glRotate to rotate the arm 45 degrees but it has not worked to my liking.....
I put -45.0 to rotate the rect 45 degrees upward and nothing happens, just stays horizontal.
replace glRotatef( -45.0f, 0.0f, 0.0f,0.0f);
with
glRotatef( -45.0f, 1.0f, 0.0f,0.0f);
or a 1.0f (or another value between 0.0 & 1.0 for fractions) for whatever axis you want to rotate it in:
glRotatef( angle, x, y, z);
with
glRotatef( -45.0f, 1.0f, 0.0f,0.0f);
or a 1.0f (or another value between 0.0 & 1.0 for fractions) for whatever axis you want to rotate it in:
glRotatef( angle, x, y, z);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement