//Micquie Bradford //CS307 Fall 2007 //Demo of Table Fan object #include #include #include #include #include twTriple baseColor = {50/255.0,0/255.0,0/255.0}; GLfloat rotA = 0; void display(void){ twDisplayInit(); twCamera(); GLfloat lightPos[] = {0, 25, 10, 0}; twGrayLight(GL_LIGHT1,lightPos,0,1.0,1); glEnable(GL_LIGHTING); glEnable(GL_LIGHT1); glShadeModel(GL_SMOOTH); twAmbient(3); mbradforDrawFan(baseColor,rotA); glFlush(); glutSwapBuffers(); }//end display(void) static void rotFan(unsigned char key, int x, int y){ switch(key){ case '+':rotA = rotA - 15; break; case '?':printf("+ to rotate fan blades\n"); break; case 'q':exit(0); break; } glutPostRedisplay(); } int main(int argc, char** argv){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); twInitWindowSize(500,500); glutCreateWindow(argv[0]); twBoundingBox(0,20,0,25,-20,0); twMainInit(); glutKeyboardFunc(rotFan); glutDisplayFunc(display); glutMainLoop(); return 0; }//end main