SFML community forums
Help => Graphics => Topic started by: shujidev on June 16, 2020, 05:34:41 am
-
I was trying to draw a buffer after removing the last vertex and I couldn't see any changes, only after this I noticed it was possible to modify a part of the vertexbuffer but apparently the buffer is not getting smaller, so is something like a resize possible somehow?
-
You'll have to call create on the VertexBuffer with a different size.
See also the example in the documentation: https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1VertexBuffer.php#details
-
Note that there's an overload of the draw function that takes the range of vertices to draw from a VertexBuffer. That allows you to change what's drawn without touching the vertex buffer; remember that they are stored in VRAM and that modifying them is an expensive operation (data goes back and forth between system RAM and VRAM, the graphics pipeline may be flushed, etc).