Moved glFlush command to window display function