Class Buffer

A data stucture that supplies per-vertex data to the GPU.


  • Buffer



context: Context

The rendering context of this buffer.

dataPrivate: TypedArray

The data contained within this buffer.

internal: WebGLBuffer

The WebGL API interface of this buffer.

target: BufferTarget

The binding point to bind this buffer to.

typePrivate: BufferDataType

The type of each component in this buffer.

The usage pattern of this buffer's data store.


  • get elementSize(): number
  • The size of each element in this buffer in bytes.

    Returns number


  • Executes the given function with this buffer bound, then re-binds the previously-bound buffer.

    Type Parameters

    • T


    • f: ((buffer) => T)

      The function to execute.

        • (buffer): T
        • Parameters

          Returns T

    Returns T

    The return value of the executed function.

  • Binds a buffer to a binding point.


    • context: Context

      The rendering context of the buffer.

    • target: BufferTarget

      The target binding point.

    • buffer: null | WebGLBuffer

      The buffer.

    Returns void

  • Gets the internal representation of the currently-bound buffer.


    • context: Context

      The context that the buffer is bound to.

    • target: BufferTarget

      The target that the buffer is bound to.

    Returns null | WebGLBuffer

    The currently-bound buffer.

  • Unbinds the buffer from the given binding point.


    Returns void

Generated using TypeDoc