This crashes my Safari browser on iOS.
replies(7):
Edit: I just profiled it and it spends 42% of exclusive time in texImage2D. It would be better to allocate a set of textures up front and then use glTexSubImage2D to update their contents. glTexImage2D allocates a new texture every time.