Class: WebGLArrayBuffer

ol/webgl/Buffer~WebGLArrayBuffer


import WebGLArrayBuffer from 'ol/webgl/Buffer';

Object used to store an array of data as well as usage information for that data. Stores typed arrays internally, either Float32Array or Uint16/32Array depending on the buffer type (ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER) and available extensions.

To populate the array, you can either use:

  • A size using #ofSize(buffer)
  • An ArrayBuffer object using #fromArrayBuffer(buffer)
  • A plain array using #fromArray(array)

Note: See the documentation of WebGLRenderingContext.bufferData for more info on buffer usage.

new WebGLArrayBuffer(type, opt_usage)

Name Type Description
type number

Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER.

usage number

Intended usage, either STATIC_DRAW, STREAM_DRAW or DYNAMIC_DRAW. Default is DYNAMIC_DRAW.