This buffer attribute class does not construct a VBO. Instead, it uses whatever VBO is passed in constructor and can later be altered via the .buffer property.

It is required to pass additional params alongside the VBO Those are: the GL context, the GL data type, the number of components per vertex, the number of bytes per component, and the number of vertices.

Constructors

  • This creates a new GLBufferAttribute object.

    Parameters

    • buffer: WebGLBuffer

      Must be a WebGLBuffer. See .buffer

    • type: number

      One of WebGL Data Types. See .type

    • itemSize: number

      How many values make up each item (vertex). See .itemSize

    • elementSize: 1 | 2 | 4

      1, 2 or 4. The corresponding size (in bytes) for the given type param. See .elementSize

    • count: number

      The expected number of vertices in VBO. See .count

    Returns GLBufferAttribute

Properties

buffer: WebGLBuffer

The current WebGLBuffer instance.

count: number

The expected number of vertices in VBO.

Expects a Integer

elementSize: 1 | 2 | 4

Stores the corresponding size in bytes for the current .type property value.

The corresponding size (in bytes) for the given "type" param.

  • gl.BYTE: 1
  • gl.UNSIGNED_BYTE: 1
  • gl.SHORT: 2
  • gl.UNSIGNED_SHORT: 2
  • gl.INT: 4
  • gl.UNSIGNED_INT: 4
  • gl.FLOAT: 4

Set this property together with .type. The recommended way is using the .setType method.

constructor`` for a list of known type sizes. @remarks Expects a 1, 2or4`

isGLBufferAttribute

Read-only flag to check if a given object is of type GLBufferAttribute.

This is a constant value

true

itemSize: number

How many values make up each item (vertex).

The number of values of the array that should be associated with a particular vertex. For instance, if this attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.

name: string

Optional name for this attribute instance.

""

type: number

A WebGL Data Type describing the underlying VBO contents.

  • gl.BYTE: 0x1400
  • gl.UNSIGNED_BYTE: 0x1401
  • gl.SHORT: 0x1402
  • gl.UNSIGNED_SHORT: 0x1403
  • gl.INT: 0x1404
  • gl.UNSIGNED_INT: 0x1405
  • gl.FLOAT: 0x1406

Set this property together with .elementSize. The recommended way is using the .setType() method.

version: number

A version number, incremented every time the needsUpdate property is set to true.

Expects a Integer

Accessors

  • set needsUpdate(value): void
  • Setting this to true increments .version.

    Parameters

    • value: boolean

    Returns void

    set-only property.

Methods

  • Sets the .buffer property.

    Parameters

    • buffer: WebGLBuffer

    Returns this

  • Sets the count property.

    Parameters

    • count: number

    Returns this

  • Sets the itemSize property.

    Parameters

    • itemSize: number

    Returns this

  • Sets the both type and elementSize properties.

    Parameters

    • type: number
    • elementSize: 1 | 2 | 4

    Returns this