replace some of the glBegin,glEnd calls with glDrawArrays