Erik Leppen
Member
How do I extend a vertex buffer with additional vertex data after it has been closed with vertex_end, and without removing all existing vertex data in it?
Basically what I want is a moving instance drawing its trajectory. Because drawing all segments every step is way too slow, I want to use a vertex buffer for this, where every step I only add the last step and then in the draw event, submit the whole thing.
But this doesn't seem to work. Basically my approach is:
Create: vb = vertex_create_buffer(...)
Step: vertex_begin(vb); add vertex data; vertex_end(vb);
Draw: vertex_submit(vb);
But this doesn't work; if I show_debug_message(vertex_get_number(vb)), I get the same number every step, instead of seeing it growing. The manual says that vertex_begin clears the old data, but I don't want that. I want to extend a vertex buffer. I tried removing vertex_end, but then I cannot submit it for drawing. I tried reading into "normal" buffers, but the docs lack a decent example of how to combine normal buffers and vertex buffers, and I can't find a good tutorial on the forums. Also it feels like overkill to learn to use this whole technology just for drawing an instance's trace curve.
There must be a simple way for this, right? (I don't want to use a surface, as I want a vector-based solution.)
Basically what I want is a moving instance drawing its trajectory. Because drawing all segments every step is way too slow, I want to use a vertex buffer for this, where every step I only add the last step and then in the draw event, submit the whole thing.
But this doesn't seem to work. Basically my approach is:
Create: vb = vertex_create_buffer(...)
Step: vertex_begin(vb); add vertex data; vertex_end(vb);
Draw: vertex_submit(vb);
But this doesn't work; if I show_debug_message(vertex_get_number(vb)), I get the same number every step, instead of seeing it growing. The manual says that vertex_begin clears the old data, but I don't want that. I want to extend a vertex buffer. I tried removing vertex_end, but then I cannot submit it for drawing. I tried reading into "normal" buffers, but the docs lack a decent example of how to combine normal buffers and vertex buffers, and I can't find a good tutorial on the forums. Also it feels like overkill to learn to use this whole technology just for drawing an instance's trace curve.
There must be a simple way for this, right? (I don't want to use a surface, as I want a vector-based solution.)