Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Freeing bufferobject memory the right way?

  1. #1
    Junior Member Regular Contributor
    Join Date
    May 2013

    Freeing bufferobject memory the right way?

    I have a C++ wraper class and now have a simple question building it.

    If I wont need the contend of a bufferobject anymore e.g. like a VertexBufferObject, rendertbuffers or texture. Shall I just use glDeleteBuffers to throw away the ID and later make a new one. Or shall I use glBufferData with a size of 0?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    glDeleteBuffers is the official way.

    Either way may or may not actually release the memory used by the old buffer, and if it does, it may or may not release it immediately. OpenGL doesn't specify when (or even if) memory is released, just that the object name is available for reuse. It's OK for the driver to not release memory but instead keep it available and use it to satisfy a future request (rather than having to make a new allocation).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts