updateBuffer method

dynamic updateBuffer(
  1. dynamic buffer,
  2. dynamic attribute,
  3. dynamic bufferType
)

Implementation

updateBuffer(buffer, attribute, bufferType) {
  var array = attribute.array;
  var updateRange = attribute.updateRange;

  gl.bindBuffer(bufferType, buffer);

  if (updateRange["count"] == -1) {
    // Not using update ranges
    gl.bufferSubData(bufferType, 0, array, 0, array.lengthInBytes);
  } else {
    print(" WebGLAttributes.dart gl.bufferSubData need debug confirm.... ");
    gl.bufferSubData(
        bufferType, updateRange["offset"] * attribute.itemSize, array, updateRange["offset"], updateRange["count"]);

    updateRange["count"] = -1; // reset range

  }
}