I have been learning computer graphics and for some time and can't seem to wrap my head around one concept. How to handle vertex data changes?
Ex. 1. I have a text rendering on a screen. And up on hitting a character corresponding glyph should be rendered. I have managed to achieve this using Open GL with dynamic draw where during each frame I would submit subbuffer data of the whole vertex and index set plus new verices for the new glyph at a 0 offset in memory. I would think this is not the optimal way to change what is shown on screen between frames, but it is good enough for learning. This aproach introduces a bug though. Or at least I have a bug. Where upon deleting a glyph and resubmiting vertex and index data the glyth would still be renderd during next frame. I guess it is because allocated buffer points to a contiguous block of memory and text rendering is just bunch of rectangles where the count of indices per glyph remains constant and until I do not clear or overwrite the subitted data at the address it will continue rendering.
Ex. 2. I have an entity loaded from .obj file the vertex and index data is converted tiny_obj_loader library. I would like for the entity to move in a scene. And not by moving or changing UBO. So I have tried this using Open GL and have achieved this using similar method to my previous example, using dynamic draw. And it worked. But once I have tried this in vulkan I have almost hit a brick wall. I can not change vertex data each frame since VkBufferMemory for vertices and indices is allocated before even commad buffers are created.
So my question is how do I manage vertex/index data changes in vulkan or more in general? Should I write some alogorithms that would determine the place in memory should be cleared or is there a better way than dynamic draw? How does it look like using vulkan? Is there some way to rebind new data and send it to gpu on every render pass?