# Animation with scaled and literal pixel objects

## Recommended Posts

cnjcombo    122
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.....

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();


I put -45.0 to rotate the rect 45 degrees upward and nothing happens, just stays horizontal.

##### Share on other sites
DrewGreen    370
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);

##### Share on other sites
cnjcombo    122
No dice, still isn't rotating at all....

glPushMatrix();	glColor3f(1.0, 1.0, 0.5); 		glScalef(40.0, 2.0, 0.0);	glRotatef( -45.0, 0.999, 0.0,0.0);		unitSquare();glPopMatrix();

## Create an account

Register a new account