/* Creative Assignment Justina Wang CS307 October 20, 2005 */ #include #include #include const int bodyHeight = 6; // parallel to the y axis const int bodyLength = 4; // parallel to the x axis const int bodyWidth = 3; // parallel to the z axis const int flowerHeight = 2; // parallel to the y axis // ***************************************** // draws a balloon. takes two parameters: the color of the petal and // the height of the stick (the balloon size is just a proportion // of the stick) // ***************************************** void drawBalloon(twTriple color, GLfloat height) { // draw the actual balloon twColor(color,0,0); glPushMatrix(); glTranslatef(0,height/2.0,0); glScalef(height/6.0,height/4.0,height/6.0); glutSolidSphere(1,20,20); glPopMatrix(); // draw the stick of the balloon twColorName(TW_BLACK); glPushMatrix(); glScalef(0.1,height,0.1); glutSolidCube(1); glPopMatrix(); } // ****************************************** // draws a petal // ****************************************** void drawPetal() { glPushMatrix(); glRotatef(-75,1,0,0); // tips the petal 15 degrees up glTranslatef(0,0.25,0); glScalef(0.2,0.5,0.2); twDisk(1,20); glPopMatrix(); } // ******************************************* // draws a flower. takes three parameters: the color of the flower, // the height of flower, and the number of petals // ******************************************* void drawFlower(twTriple color,GLfloat numPetals) { // draws the petals first twColor(color,0,0); glPushMatrix(); glTranslatef(0,flowerHeight,0); for (int i=0; i