/* Mala Sarkar CS307 Fall 2005 Demo of Hanging Ceiling Light */ #include #include #include //#include "msarkar.cc" #include //default light height const int lightHeight = 30; //default color of the light structure twTriple mediumGray = {0.5,0.5,0.5}; //default color of the bulb twTriple yellow = {1,1,0}; void setLight () { glEnable(GL_LIGHTING); //directional light GLfloat light0[4]={1,2,1,0}; twGrayLight(GL_LIGHT0,light0,0.3,0.1,0.2); } void display(void) { twDisplayInit(); twCamera(); //set up camera based on bounding box coordinates setLight(); glShadeModel(GL_SMOOTH); //draw ceiling light msarkarCeilingLight(lightHeight,mediumGray,yellow); glFlush(); glutSwapBuffers(); // necessary for animation } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); twInitWindowSize(650,650); glutCreateWindow(argv[0]); glutDisplayFunc(display); //create a bounding box tailored to fit the hanging light and light shade twBoundingBox(-7,7,-lightHeight-lightHeight*0.1,0,-7.5,7.5); twMainInit(); glutMainLoop(); return 0; }