made delay variable local to paintGL()