Пример #1
0
void drawWings(float wingHeight, float wingWidth){
	drawTopWing(-wingWidth, 0, wingWidth, wingHeight, wingWidth);
	drawBottomWing(-wingWidth, 0, wingWidth, -wingHeight, wingWidth);
	drawLeftWing(0, -wingWidth, -wingHeight, wingWidth, wingWidth);
	drawRightWing(0, -wingWidth, wingHeight, wingWidth, wingWidth);
}
Пример #2
0
/* draws a penguin centered (roughly) at the origin
   Also moves him around in a circle
   It now takes a parameter that indicates whether or
   no the penguin is a shadow (just for coloring purposes) */
void drawPenguin( int is_shadow )
{
	/* the colors we apply to the bird */
	/* Black does not really show lighting very well,
	   (or at all!) so the bird is now a blusih colour */
	GLfloat bluish[3];
	GLfloat orange[3];

	if( is_shadow )
	{
		/* bluish and orange are both grey for a shadow */
		bluish[0] = bluish[1] = bluish[2] = 0.2;
		orange[0] = orange[1] = orange[2] = 0.2;
	}
	else
	{
		/* for normal penguin, normal colors */
		bluish[0] = 0.08;
		bluish[1] = 0.2;
		bluish[2] = 0.35;

		orange[0] = 1.0;
		orange[1] = 0.5;
		orange[2] = 0.0;
	}

	/* draw main body and head bluish */
	glColor3fv( bluish );

	glPushMatrix( );
		/* Wobble the body a little bit */
		glRotatef( wobble_amount, 0.0, 0.0, 1.0 );
		drawHead( );
		drawBody( );

		/* draw the beak orange */
		glColor3fv( orange );
		drawBeak( );
	glPopMatrix( );

	/* draw penguin's left wing bluish */
	glColor3fv( bluish );
	drawLeftWing( );

	/* draw the left foot orange */
	glColor3fv( orange );
	drawLeftFoot( );

	/* to draw the penguins' right appendages, we just invert the world
	   along the X axis, and draw the left ones over again... */
	glScalef( -1.0, 1.0, 1.0 );

	glColor3fv( bluish );		/* bluish wing */
	drawLeftWing( );
	
	/* orange */
	glColor3fv( orange );
	/* to make the left and right rotate on an opposite way, we invert the right one... */
	GLfloat temp = foot_move_amount;
	foot_move_amount = abs( 90.0 - foot_move_amount );
	drawLeftFoot( );
	foot_move_amount = temp;	/* reset the value for the left foot */
}