Window Coordinates

Window coordinates can be used for drawing, when an appropriate orthographic projection is defined

    def reshape(width, height):
        glViewport(0, 0, width, height)
        glMatrixMode(GL_PROJECTION)
        glLoadIdentity()
        gluOrtho2D(0, width, 0, height)
        glMatrixMode(GL_MODELVIEW)

Because +Y points up for OpenGL drawing, but points down in window coordinates, we must flip the Y coordinate:

glTranslate(mx, glutGet(GLUT_WINDOW_HEIGHT)-my, 0)
glutWireTeapot(1)

next