/* Jackie Shaw CS307 F07 Demo of the Guitar Modified for Material and Lighting */ /*note: the lighting and consistency is not perfect, but it is close. further modification will be done to make the lighting appear exacly how it is supposed to look. */ #include #include //#include "jshaw2.cpp" #include // the size of my guitar, i.e. // the size of the radius float guitarsize = 1; void display(void) { twDisplayInit(); twCamera(); twAmbient(.1); //two lights are added. one is directional and one is a light from a point //source. twGrayLight is used GLfloat light0[] = {-4, 4, 2, 1}; GLfloat light1[] = {4, 4, 1, 0}; twGrayLight(GL_LIGHT1, light1, .1, .75, .1); twGrayLight(GL_LIGHT0, light0, .45, .55, .85); //light 0 is the brighter //"most visible" light glEnable(GL_LIGHTING); drawGuitar2(guitarsize); glFlush(); glutSwapBuffers(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); twInitWindowSize(500,500); glutCreateWindow(argv[0]); glutDisplayFunc(display); //set up the bounding box based on the size twBoundingBox(-7*guitarsize, 7*guitarsize, -13*guitarsize, 24.0*guitarsize, -4*guitarsize,guitarsize); twMainInit(); glutMainLoop(); return 0; }