// Test for drawing a mailbox. It actually draws 3 mailboxes, so you can see the differences. // By: Stella del Rosario #include #include //#include "sdelrosa.cc" #include float mailboxHeight=80; void light(){ // light comes from the upper right GLfloat direction[]={2,1,1,0}; twGrayLight(GL_LIGHT0, direction, 0.1,0.8,0.8); glEnable(GL_LIGHT0); } void display(void) { twDisplayInit(); twCamera(); // sets up camera based on bounding box coords. glPushAttrib(GL_ALL_ATTRIB_BITS); glEnable(GL_LIGHTING); glShadeModel(GL_SMOOTH); twAmbient(0.4); light(); // Draw green mailbox glPushMatrix(); glRotatef(10,0,1,0); sdelrosaMailbox(mailboxHeight, 1); glPopMatrix(); // Draw purple mailbox glPushMatrix(); glTranslatef(mailboxHeight*.8,0,0); glRotatef(-40,0,1,0); sdelrosaMailbox(mailboxHeight, 2); glPopMatrix(); // Draw red mailbox glPushMatrix(); glTranslatef(-mailboxHeight*.8,0,0); glRotatef(60,0,1,0); sdelrosaMailbox(mailboxHeight, 0); glPopMatrix(); glPopAttrib(); glFlush(); glutSwapBuffers(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); twInitWindowSize(800,650); glutCreateWindow(argv[0]); twBoundingBox(-mailboxHeight*1.5,mailboxHeight*1.5,0, 80,-mailboxHeight, mailboxHeight); twMainInit(); glutDisplayFunc(display); glutMainLoop(); return 0; }