I'm doing 2D drawing in a glut window, and I'm having trouble making the window resize properly.
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?
glutDisplayFunc:
void displayFunc() {
glDisable( GL_DEPTH_TEST );
glClear( GL_COLOR_BUFFER_BIT );
glPointSize ( 3.0 );
glFlush();
}
glutReshapeFunc:
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;
}