/******************************************************************* Your tree Support Routines ******************************************************************** Author: Date: Comments: This is the template file for Program Assignment 2. You should put your functions in this file. Multiple files are OK, if you feel that is more appropriate. ********************************************************************/ #include #include #include #include "const.h" #include "types.h" #include "funcs.h" /* replace the following function with your own, that will draw a Tree */ /* Use of the display list object is recommended */ void drawTree(treeType *tree) { static GLint cylinder; if(tree==0) return; if(cylinder==0) /* obtain an OpenGL display list ID */ cylinder = glGenLists(1); /* create a display list object for a cylinder */ glNewList(cylinder,GL_COMPILE); /* approximate cylinder's circle with 24 segments */ solidCylinder(tree->x,tree->y,tree->z,tree->base_radius, tree->base_length, 24); glEndList(); /* call the cylinder */ glMatrixMode(GL_MODELVIEW); glPushMatrix(); glCallList(cylinder); glPopMatrix(); }