title: Resizing glut window
body: <p>I'm doing 2D drawing in a glut window, and I'm having trouble making the window resize properly.</p>
  
  <p>My glutDisplayFunc and glutReshapeFunc are below.  As it is, the drawing disappears when the window is resized.  If I delete the glClear() from displayFunc(), new pixels don't "initialize" and there are clipping problems.  How do I fix this?</p>
  
  <p>glutDisplayFunc:</p>
  
  <pre><code>void displayFunc() {
    glDisable( GL_DEPTH_TEST );
    glClear( GL_COLOR_BUFFER_BIT );
    glPointSize ( 3.0 );
    glFlush();
  }
  </code></pre>
  
  <p>glutReshapeFunc:</p>
  
  <pre><code>void windowReshapeFunc( GLint newWidth, GLint newHeight ) {
    glViewport( 0, 0, newWidth, newHeight );
    glMatrixMode( GL_PROJECTION );
    glLoadIdentity();
    gluOrtho2D( 0, GLdouble (newWidth), 0, GLdouble (newHeight) );
  
    windowWidth = newWidth;
    windowHeight = newHeight;
  }
  </code></pre>