Class GLBufferAttribute

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

    Returns GLBufferAttribute

Properties

isGLBufferAttribute: true

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

This is a constant value

true

name: string

Optional name for this attribute instance.

""

buffer: WebGLBuffer

The current WebGLBuffer 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.

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.

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`

count: number

The expected number of vertices in VBO.

Expects a Integer

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

    Returns this

  • Sets the both type and elementSize properties.

    Parameters

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

    Returns this

  • Sets the itemSize property.

    Parameters

    • itemSize: number

    Returns this

  • Sets the count property.

    Parameters

    • count: number

    Returns this