gluOrtho2D is typically used either in the drawing function, or in GLUT's reshape callback.
The reshape callback is called whenever the window changes size.
e.g., to make the window always span -10 to +10 in X, while keeping the aspect ratio 1:1, the coordinate range in Y will depend on the window size:
def reshape(w, h): glViewport(0, 0, w, h) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluOrtho2D(-10.0, 10.0, -10.0*h/w, 10.0*h/w) glMatrixMode(GL_MODELVIEW) glutReshapeFunc(reshape)