Пример #1
0
void draw::draw_dog(){
    glPushMatrix();
        draw_back();
        draw_leg();
        //draw_tail();
        //draw_nnh();
    glPopMatrix();
}
void object(void)
{
	// allows fox to move across the screen
	glTranslatef(body_pos, 0.0, 0.0);
	// rotate body by body_rotate degrees
	glRotatef(body_rotate, 0.0, 0.0, 1.0);

	glPushMatrix();
	// draw body and body parts of fox
	draw_torso();

	glTranslatef(-40.0, 70.0, 0.0);		// M_(torso to head)
	draw_head();

	glTranslatef(-12.0, 34.0, 0.0);			// M_(head to left ear)
	draw_ear();

	glTranslatef(23.0, 0.0, 0.0);			// M_(left ear to right ear)
	// rotate tail by tail_pos degrees
	glRotatef(tail_pos, 0, 0, 1);
	draw_ear();

	glTranslatef(90.0, -60.0, 0.0);		// M_(right ear to tail)
	draw_tail();

	// using its own matrix allows the front leg to pivot independently of the back leg
	glPushMatrix();
	glTranslatef(-110, -45, 0);	// M_(tail to front leg)
	// rotate front leg by front_leg_pos degrees
	glRotatef(front_leg_pos, 0.0, 0.0, 1.0);
	draw_leg();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-25, -45, 0);		// M_(front leg to back leg)
	// rotate back leg by back_leg_pos degrees
	glRotatef(back_leg_pos, 0.0, 0.0, 1.0);
	draw_leg();
	glPopMatrix();

	glPopMatrix();
}