void fist(float wristangle){ matrixPush(ModelView); matrixRotate(ModelView, wristangle, 0, 0, 1); matrixPush(ModelView); matrixScale(ModelView, .5, .5, 1); joint(); matrixPop(ModelView); hand(); matrixPop(ModelView); }
void feet(float footangle){ matrixPush(ModelView); matrixRotate(ModelView, footangle, 0, 0, 1); matrixPush(ModelView); matrixScale(ModelView, .9, .9, 1); joint(); matrixPop(ModelView); matrixPush(ModelView); matrixScale(ModelView, -1, 1, 1); foot(); matrixPop(ModelView); matrixPop(ModelView); }
void leg(float upperlegangle, float lowerlegangle, float footangle){ matrixPush(ModelView); matrixRotate(ModelView, upperlegangle, 0, 0, 1); joint(); matrixPush(ModelView); matrixScale(ModelView, 2, 1, 1); arm_segment(); matrixPop(ModelView); matrixTranslate(ModelView, 0, -6, 0); lower_leg(lowerlegangle, footangle); matrixPop(ModelView); }
void lower_leg(float lowerlegangle, float footangle){ matrixPush(ModelView); matrixRotate(ModelView, lowerlegangle, 0, 0, 1); matrixPush(ModelView); matrixScale(ModelView, .9, .9, 1); joint(); matrixPop(ModelView); matrixPush(ModelView); matrixScale(ModelView, 1.8, .8 , 1); arm_segment(); matrixPop(ModelView); matrixTranslate(ModelView, 0, -4.8, 0); feet(footangle); matrixPop(ModelView); }
void arm(float upperarmangle, float lowerarmangle, float wristangle){ matrixPush(ModelView); matrixRotate(ModelView, upperarmangle, 0, 0, 1); matrixPush(ModelView); matrixScale(ModelView, .625, .625, 1); joint(); matrixPop(ModelView); matrixPush(ModelView); matrixScale(ModelView, 1.25, 1, 1); arm_segment(); matrixPop(ModelView); matrixTranslate(ModelView, 0, -6, 0); forearm(lowerarmangle, wristangle); matrixPop(ModelView); }
void forearm(float lowerarmangle, float wristangle){ matrixPush(ModelView); matrixRotate(ModelView, lowerarmangle, 0, 0, 1); matrixPush(ModelView); matrixScale(ModelView, .5, .5, 1); joint(); matrixPop(ModelView); arm_segment(); matrixPush(ModelView); matrixTranslate(ModelView, 0, -6, 0); fist(wristangle); matrixPop(ModelView); matrixPop(ModelView); }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); // glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); matrixPush(ModelView); generateTerrain(); matrixPop(ModelView); glutSwapBuffers(); }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glEnable(GL_DEPTH_TEST); glDisable(GL_POLYGON_OFFSET_FILL); glLineWidth(1.0); glPolygonMode(GL_FRONT, GL_LINE); matrixPush(ModelView); matrixRotate(ModelView,center,0,0,1); ellipsoidWireFrame(); matrixPop(ModelView); glutSwapBuffers(); }
void robot(){ matrixPush(ModelView); matrixRotate(ModelView, torso_angle, 0, 0, 1); torso(); matrixPush(ModelView); matrixTranslate(ModelView, 0, 10.2, 0); matrixRotate(ModelView, head_angle, 0, 0, 1); head(); matrixPush(ModelView); matrixTranslate(ModelView, .5, 2.5, 0); eye(); matrixPop(ModelView); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, -4.5, 7, 0); matrixRotate(ModelView, -45, 0, 0, 1); arm(left_upper_arm_angle, left_lower_arm_angle, left_wrist_angle); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, 4.5, 7, 0); matrixRotate(ModelView, 45, 0, 0, 1); arm(right_upper_arm_angle, right_lower_arm_angle, right_wrist_angle); matrixPop(ModelView); matrixPush(ModelView); lower_torso(); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, -2, -1.5, 0); matrixRotate(ModelView, -30, 0, 0, 1); leg(left_upper_leg_angle, left_lower_leg_angle, left_foot_angle); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, 2, -1.5, 0); matrixRotate(ModelView, 30, 0, 0, 1); right_leg(right_upper_leg_angle, right_lower_leg_angle, right_foot_angle); matrixPop(ModelView); matrixPop(ModelView); }
void right_leg(float upperlegangle, float lowerlegangle, float footangle){ matrixPush(ModelView); matrixScale(ModelView, -1, 1, 1); leg(upperlegangle, lowerlegangle, footangle); matrixPop(ModelView); }