text: #include <GL/glut.h>   // The GL Utility Toolkit (GLUT) Header
  
  bool g_gamemode;       // GLUT GameMode ON/OFF
  bool g_fullscreen;     // Fullscreen Mode ON/OFF (When g_gamemode Is OFF)
  
  // Our GL Specific Initializations
  bool init(void)
  {
  	glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
  	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);				// Black Background
  	glClearDepth(1.0f);									// Depth Buffer Setup
  	glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
  	glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do
  	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations
  	return true;
  }
  
  // Our Rendering Is Done Here
  void render(void)   
  {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	// Clear Screen And Depth Buffer
      glLoadIdentity();									// Reset The Current Modelview Matrix
  	glTranslatef(-1.5f,0.0f,-6.0f);						// Move Left 1.5 Units And Into The Screen 6.0
  	glBegin(GL_TRIANGLES);								// Drawing Using Triangles
  		glVertex3f( 0.0f, 1.0f, 0.0f);					// Top
  		glVertex3f(-1.0f,-1.0f, 0.0f);					// Bottom Left
  		glVertex3f( 1.0f,-1.0f, 0.0f);					// Bottom Right
  	glEnd();											// Finished Drawing The Triangle
  	glTranslatef(3.0f,0.0f,0.0f);						// Move Right 3 Units
  	glBegin(GL_QUADS);									// Draw A Quad
  		glVertex3f(-1.0f, 1.0f, 0.0f);					// Top Left
  		glVertex3f( 1.0f, 1.0f, 0.0f);					// Top Right
  		glVertex3f( 1.0f,-1.0f, 0.0f);					// Bottom Right
  		glVertex3f(-1.0f,-1.0f, 0.0f);					// Bottom Left
  	glEnd();
  
      // Swap The Buffers To Become Our Rendering Visible
      glutSwapBuffers ( );
  }
  
  // Our Reshaping Handler (Required Even In Fullscreen-Only Modes)
  void reshape(int w, int h)
  {
  	glViewport(0, 0, w, h);
  	glMatrixMode(GL_PROJECTION);     // Select The Projection Matrix
  	glLoadIdentity();                // Reset The Projection Matrix
  	// Calculate The Aspect Ratio And Set The Clipping Volume
  	if (h == 0) h = 1;
  	gluPerspective(80, (float)w/(float)h, 1.0, 5000.0);
  	glMatrixMode(GL_MODELVIEW);      // Select The Modelview Matrix
  	glLoadIdentity();                // Reset The Modelview Matrix
  }
  
  // Our Keyboard Handler (Normal Keys)
  void keyboard(unsigned char key, int x, int y)
  {
  	switch (key) {
  		case 27:        // When Escape Is Pressed...
  			exit(0);    // Exit The Program
  		break;          // Ready For Next Case
  		default:        // Now Wrap It Up
  		break;
  	}
  }
  
  // Our Keyboard Handler For Special Keys (Like Arrow Keys And Function Keys)
  void special_keys(int a_keys, int x, int y)
  {
  	switch (a_keys) {
  		case GLUT_KEY_F1:
  			// We Can Switch Between Windowed Mode And Fullscreen Mode Only
  			if (!g_gamemode) {
  				g_fullscreen = !g_fullscreen;       // Toggle g_fullscreen Flag
  				if (g_fullscreen) glutFullScreen(); // We Went In Fullscreen Mode
  				else glutReshapeWindow(500, 500);   // We Went In Windowed Mode
  			}
  		break;
  		default:
  		break;
  	}
  }
  
  	
  // Main Function For Bringing It All Together.
  int main(int argc, char** argv)
  {
  //	ask_gamemode();                                  // Ask For Fullscreen Mode
  	glutInit(&argc, argv);                           // GLUT Initializtion
  	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);     // Display Mode (Rgb And Double Buffered)
  	glutInitWindowSize(800, 600);                // Window Size If We Start In Windowed Mode
  	glutCreateWindow("NeHe's OpenGL Framework"); // Window Title 
  
  	init();                                          // Our Initialization
  	glutDisplayFunc(render);                         // Register The Display Function
  	glutReshapeFunc(reshape);                        // Register The Reshape Handler
  	glutKeyboardFunc(keyboard);                      // Register The Keyboard Handler
  	glutSpecialFunc(special_keys);                   // Register Special Keys Handler
  	glutMainLoop();                                  // Go To GLUT Main Loop
  	return 0;
  }
  