I'm wondering how to efficiently remove a triangle from the middle a webgl attribute buffer.
The first solution that comes to mind would be to rebuffer all the data from the middle to the end, shifting everything back one. This seems pretty inefficient for just wanting to remove a single triangle.
The second solution that I thought of would be to add an additional attribute to track whether a triangle was removed and if so move it outside the frustum in the vertex shader to get culled. This adds memory overhead and I guess you would want to track the triangles that were removed in order to reuse those chunks of memory.
I guess a third way would be to take the last triangle in the buffer and move it into the spot of the triangle being removed and then decrement the number of triangles to draw.
Is there a common way to solve this problem?