pex-renderer icon indicating copy to clipboard operation
pex-renderer copied to clipboard

Geometry dispose doesn't delete buffers

Open dmnsgn opened this issue 6 years ago • 1 comments

See glTF example where changing models keeps increasing the numbers of buffers.

dmnsgn avatar May 01 '19 15:05 dmnsgn

Current workaround:

function cleanUpGeometryBuffers(ctx, geometry) {
  if (geometry._indices.buffer) ctx.dispose(geometry._indices.buffer)

  Object.values(geometry._attributes).forEach((attribute) => {
    if (attribute.buffer) ctx.dispose(attribute.buffer)
  });
}

dmnsgn avatar May 14 '19 19:05 dmnsgn