next up previous
Next: Initialization Up: Code Previous: global variables and constants

main

This is just a basic main function for OpenGL. The first few lines simply enact the use of OpenGL. Comments generaly describe what happens with each line. The calls to glut_Func set the different functions for reshaping and displaying the window as well as what to call when a key is pressed or when the mouse is clicked/moved. the loop function starts the program running.

int main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
    glutInitWindowPosition(50, 50);  	// initialize window here (50, 50)
    glutInitWindowSize(int(winsize), int(winsize));	// at this size
    glutCreateWindow("Hand");		// actually create it with this title
    //srand(time(0));		// randomization: currently unneccessary
    myinit();				// my initialization
    glutReshapeFunc(myReshape);		// reshape func
    glutDisplayFunc(display);		// display func
    glutKeyboardFunc(key);		// keyboard func: input
    glutMouseFunc(mous);  // when mouse first clicked: input
	glutMotionFunc(mouser);  // when mouse is moved: input
	
    glutMainLoop();			// loop
    return 0;             		// return statement
}



Michael Hull 2003-06-11