The Codevoid DrawRobot(void) { /*-------------BUST AND HEAD--------------*/ glPushMatrix(); glRotatef(bust_angle_y,0,1,0); glRotatef(bust_angle_x,1,0,0); glPushMatrix(); glCallList(bust); glCallList(head); glPopMatrix(); /*--------RIGHT ARM AND FOREARM---------*/ glPushMatrix(); glTranslatef(0,0.25,0); glRotatef(right_arm_angle,1,0,0); glTranslatef(0,-0.25,0); glPushMatrix(); glCallList(right_arm); glPopMatrix(); glPushMatrix(); glTranslatef(1.25,-0.7,0); glRotatef(right_forearm_angle,1,0,0); glTranslatef(-1.25,0.7,0); glCallList(right_forearm); glPopMatrix(); glPopMatrix(); /*---------LEFT ARM AND FOREARM---------*/ glPushMatrix(); glTranslatef(0,0.25,0); glRotatef(left_arm_angle,1,0,0); glTranslatef(0,-0.25,0); glPushMatrix(); glCallList(left_arm); glPopMatrix(); glPushMatrix(); glTranslatef(1.25,-0.7,0); glRotatef(left_forearm_angle,1,0,0); glTranslatef(-1.25,0.7,0); glCallList(left_forearm); glPopMatrix(); glPopMatrix(); and so on... In the main function I added some keys to control the robot. They are:
And finally here the bin & source. Happy coding... Arturo "IRIX" Montieri : montieri@hotmail.com
|