Is it possible to in-place resize VBOs?

前端 未结 3 1889
北恋
北恋 2020-12-20 12:34

The title says everything, but just to be clear I\'ll add some extra words.

In this case, resize means:

  • getting more storage space at the end
3条回答
  •  心在旅途
    2020-12-20 12:54

    I think without doing a copy you won't get around this, because the only way to resize a buffer is to call glBufferData and there is IMO no way to tell the driver to keep the old data.

    What you probably can do to at least not copy it to the CPU and back again, is creating some kind of auxiliary VBO for these purposes and copy directly from the VBO into the auxiliary VBO (using the ARB_copy_buffer extension), resize the VBO and copy its contents back.

    But I think the best way is just to allocate a larger buffer beforehand, so the resize is not neccessary, but of course in this case you need to know approximately how much extra storage you need.

提交回复
热议问题