Sign in to follow this  
cnjcombo

Animation with scaled and literal pixel objects

Recommended Posts

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 this post


Link to post
Share on other sites
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 this post


Link to post
Share on other sites
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();

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this