Class VertexBuffer

An array of binary data to be used as a vertex buffer object. Must contain unsigned integers.

Hierarchy (View Summary)

  • Buffer<ArrayBufferView>
    • VertexBuffer

Constructors

Properties

Accessors

Methods

Constructors

  • Create a buffer to be used as anything other than an element array buffer.

    Parameters

    • context: Context

      The rendering context.

    • data: number | ArrayBufferView<ArrayBufferLike>

      The initial data contained in this buffer or the size of this buffer's data store in bytes.

    • usage: BufferUsage = BufferUsage.STATIC_DRAW

      The intended usage of the buffer.

    • offset: undefined | number = ...

      The index of the element to start reading the initial data at.

    • length: undefined | number = ...

      The length of the initial data to read into the buffer.

    • isHalf: boolean = false

      Whether or not the data contains half floats if it contains floats.

    Returns VertexBuffer

    UnsupportedOperationError if a buffer cannot be created.

Properties

context: Context

The rendering context.

Accessors

  • get isHalf(): boolean
  • Whether or not this buffer contains 16-bit floating-point data if it contains floating-point data.

    Returns boolean

Methods

  • Replace the data in this buffer.

    Parameters

    • data: ArrayBufferView<ArrayBufferLike>

      The data to store in this buffer or the size to set this buffer's data store to in bytes.

    • Optionalusage: BufferUsage

      The intended usage of the buffer.

    • Optionaloffset: number

      The index of the element to start reading the supplied data at.

    • Optionallength: number

      The length of the supplied data to read.

    • OptionalisHalf: boolean

      Whether or not the data contains 16-bit floating-point data if it contains floating-point data.

    Returns void

  • Set the size of this buffer, clearing its data.

    Parameters

    • data: number

      The data to store in this buffer or the size to set this buffer's data store to in bytes.

    • Optionalusage: BufferUsage

      The intended usage of the buffer.

    • Optional_: unknown

      An unused value.

    • Optional__: unknown

      An unused value.

    • OptionalisHalf: boolean

      Whether or not the data contains 16-bit floating-point data if it contains floating-point data.

    Returns void

  • Update a subset of the data in this buffer.

    Parameters

    • data: ArrayBufferView<ArrayBufferLike>

      The data to store in this buffer.

    • Optional_: unknown

      An ignored value.

    • Optionaloffset: number

      The index of the element to start reading the supplied data at.

    • Optionallength: number

      The length of the supplied data to read.

    • Optional__: unknown

      An ignored value.

    • OptionalreplaceOffset: number

      The offset in bytes to start replacing data at.

    Returns void