files/en-us/web/api/webgl2renderingcontext/buffersubdata/index.md
{{APIRef("WebGL")}}{{AvailableInWorkers}}
The WebGL2RenderingContext.bufferSubData() method of the
WebGL API updates a subset of a buffer
object's data store.
bufferSubData(target, dstByteOffset, srcData)
bufferSubData(target, dstByteOffset, srcData, srcOffset)
bufferSubData(target, dstByteOffset, srcData, srcOffset, length)
target
gl.ARRAY_BUFFER
gl.ELEMENT_ARRAY_BUFFER
gl.COPY_READ_BUFFER
gl.COPY_WRITE_BUFFER
gl.TRANSFORM_FEEDBACK_BUFFER
gl.UNIFORM_BUFFER
gl.PIXEL_PACK_BUFFER
gl.PIXEL_UNPACK_BUFFER
dstByteOffset
srcData
srcOffset {{optional_inline}}
length {{optional_inline}}
bufferSubData should calculate the length.None ({{jsxref("undefined")}}).
gl.INVALID_VALUE error is thrown if the data would be written past
the end of the buffer or if data is null.gl.INVALID_ENUM error is thrown if target is not one of
the allowed enums.{{Specifications}}
{{Compat}}