/* include section */ #include /* other includes as needed */ /* typedef section as needed */ /* global data section as needed */ /* function template section */ void doMyInit( void ); void display( void ); void reshape( int, int ); void idle( void ); /* others as defined */ /* initialization function */ void doMyInit( void ) { /* set up basic OpenGL parameters and environment */ /* set up projection transformation (ortho or perspective) */ } /* reshape function */ void reshape( int w, int h ) { /* set up projection transformation with new window dimensions w and h */ glPostRedisplay( ); } /* display function */ void display( void ){ /* set up viewing transformation as described in later chapters define whatever transformations, appearance, and geometry you need */ glPostRedisplay( ); } /* idle function */ void idle( void ) { /* update anything that changes from one step of the program to another */ glPostRedisplay( ); } /* other graphics and application functions as needed */ /* main function -- set up the system and then turn it over to events */ void main( int argc, char** argv ) { /* initialize system through GLUT and your own initialization */ glutInit( &argc, argv ); /* Default GLUT_SINGLE; GLUT_RGB */ glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB ); /* Default 300 X 300 */ glutInitWindowSize( windowWidth, windowHeight ); /* Default up to windowing system */ glutInitWindowPosition( topLeftX, topLeftY ); /* Parmeter labels the title bar of the window */ glutCreateWindow( "A Sample Program" ); doMyInit( ); /* define callbacks for events */ glutDisplayFunc( display ); glutReshapeFunc( reshape ); glutIdleFunc( idle ); /* go into main event loop */ glutMainLoop( ); }