Nah, deleting tris should be very very fast. Depending on how your doing things. First off, most rendering (except vertex buffers) is done by simply passing vertices to the graphics card.
This will simply be called every frame. As you can see the actual coordinates are defined in this loop. When I first found this out I was pretty suprised, since I assumed that you would pass your meshes to the Gfx card memory and then simply pass matrices and vertex manipulations commands to the Gfx card. Turns out vertex buffers are something like this, although I'm not sure about the manipulation part, its good for static meshs like levels.
So, to "delete" a tris all you have to do is leave it out of the render loop. The speed of this operation all depends on your internal organization.
If you dont care to much about mem or you are going to have a Cleanup() function or something, you can store a flag along with each triangle telling whether or not it has been deleted. The cleanup function could eliminate these entries and move all the other triangles down in the list, to take up the empty space.
An addition to the above method would be to have a list of memory addresses (pointers) to the deleted triangles. Then, when a triangle is added, it is simply added in the location of the last item in the list of triangles deleted, and that item in the list of triangles deleted is removed. This way, the cleanup function could run quite alot faster with only the price of a little memory.
void Render() { glPushMatrix(); glBegin(GL_TRIANGLES); glVertex3f(-20.0f, -20.0f, 5.0f); glVertex3f(20.0f, -20.0f, 5.0f); glVertex3f(0.0f, 20.0f, 5.0f); glEnd(); glPopMatrix(); glutSwapBuffers(); }
This will simply be called every frame. As you can see the actual coordinates are defined in this loop. When I first found this out I was pretty suprised, since I assumed that you would pass your meshes to the Gfx card memory and then simply pass matrices and vertex manipulations commands to the Gfx card. Turns out vertex buffers are something like this, although I'm not sure about the manipulation part, its good for static meshs like levels.
So, to "delete" a tris all you have to do is leave it out of the render loop. The speed of this operation all depends on your internal organization.
If you dont care to much about mem or you are going to have a Cleanup() function or something, you can store a flag along with each triangle telling whether or not it has been deleted. The cleanup function could eliminate these entries and move all the other triangles down in the list, to take up the empty space.
An addition to the above method would be to have a list of memory addresses (pointers) to the deleted triangles. Then, when a triangle is added, it is simply added in the location of the last item in the list of triangles deleted, and that item in the list of triangles deleted is removed. This way, the cleanup function could run quite alot faster with only the price of a little memory.