My tests , updating the index like this.index = …
It causes problems with the texture rendering because the length keeps changing per update. So some of the previous texture is still there because of the original index data.
The updates is not per animation frame. But I have implemented a subtitle feature that will change the text quite regularly per subtitle text track cue for instance.
To be specific I am trying to optimise and modify a current library for efficient msdf text rendering as its not efficient enough. Its very bloaty and runs multiple loops for no reason. Which is not part of three.js but uses it. I have initial mods up on my github.
So each text content change the length of the glyph textures change and therefore the size of the type array does too.
I guess I have to reset all the attributes rather than reuse them ?
The index has to be reset to a new set of indices definitely and this seems to work with a new typed array
this.setIndex( new BufferAttribute( indices, 1 ) );
this.index.needsUpdate = true;
However how about uv and position ?
I am getting this error trying to update the current position when the length of the buffer is too big
“[.Offscreen-For-WebGL-00000242A19EF050]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 0”
Sorry for the dumb questions and stating the obvious.