reset password
Author Message
skim144
Posts: 63
Posted 21:42 May 08, 2015 |

So far, here is how my drawing has been done.

 

glRotated(r,x,y,z);

glTranslated(x,y,z);

 

glPushMatrix();         

..translate, rotate blah blah

drawSphere

glPopMatrix();

 

glPushMatrix();

..translate, rotate

drawCube

glPopMatrix();

 

 

So when I try to rotate or translate by using the glRotated(r,x,y,z) and glTranslated(x,y,z) on the top,

it should move everything, and it did.

However, when it moves about 10 pixels, (or 10 'UP' commands), some blocks move but some blocks don't, as if they are floating.

 

Has anybody encountered this problem?
 

skim144
Posts: 63
Posted 21:50 May 08, 2015 |

problem solved. I didn't pop all of the matrices

lbriggs
Posts: 57
Posted 15:03 May 09, 2015 |
I found it helpful to do as little pushing and poping as possible. Since, the next object you draw needs the translation/rotation of the previous object it reduces the amount of duplication of translations/rotations. In my program I only push/pop for the fingers and it greatly reduced the amount amount of code I wrote for the elbow, forearm, and wrist.