Пример #1
0
void person()
{
    torso();
    glPushMatrix();
        head();
    glPopMatrix();
    glPushMatrix();
        upper_right_arm();
        lower_arm();
        hand();
    glPopMatrix();
    glPushMatrix();
        upper_left_arm();
        lower_arm();
        hand();
    glPopMatrix();
    glPushMatrix();
        upper_right_leg();
        lower_leg();
    glPopMatrix();
    glPushMatrix();
        upper_left_leg();
        lower_leg();
    glPopMatrix();
}
Пример #2
0
void renderScene()
{
    // Clear framebuffer & depth buffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    //Enable lighting
    glEnable(GL_LIGHTING);
    //Set the material properties
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, emerald_ambient);
    glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, emerald_diffuse);
    glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, emerald_specular);
    glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, emerald_shininess);

    // Reset Modelview matrix
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    // Set view position & direction
    // (Camera at (0,0,5) looking down the negative Z-axis)
    gluLookAt(0, 0, 5, 0, 0, -1, 0, 1, 0);

    torso();
    glPushMatrix();
        head();
    glPopMatrix();
    glPushMatrix();
        upper_right_arm();
        lower_arm();
        hand();
    glPopMatrix();
    glPushMatrix();
        upper_left_arm();
        lower_arm();
        hand();
    glPopMatrix();
    glPushMatrix();
        upper_right_leg();
        lower_leg();
    glPopMatrix();
    glPushMatrix();
        upper_left_leg();
        lower_leg();
    glPopMatrix();

    glutSwapBuffers();
}
Пример #3
0
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);
}