Skip to main content

Abstract Class: VertexArray

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:28

Stores attribute bindings. Makes it easy to share a render pipeline and use separate vertex arrays.

Note​

Backend-specific attribute accessor metadata is no longer stored in the shared base class. WebGL derives and caches that information in its own implementation, while WebGPU only tracks the logical buffer bindings it needs to rebind at draw time.

Extends​

Constructors​

Constructor​

new VertexArray(device, props): VertexArray

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:54

Creates a backend-agnostic vertex-array container.

Parameters​

device​

Device

The device that owns the vertex array.

props​

VertexArrayProps

Vertex-array initialization properties.

Returns​

VertexArray

Overrides​

DeviceResource.constructor

Properties​

attributeByteOffsets​

attributeByteOffsets: number[]

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:47

Byte offsets added to every attribute read from each buffer slot or attribute location.


attributes​

attributes: (Buffer | TypedArray | null)[]

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:45

Buffers or constants indexed by backend-defined buffer slot or attribute location.


device​

abstract readonly device: Device

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:127

The device that this resource is associated with

Inherited from​

DeviceResource.device


handle​

abstract readonly handle: unknown

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:129

The handle for the underlying resource, e.g. WebGL object or WebGPU handle

Inherited from​

DeviceResource.handle


id​

id: string

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:121

props.id, for debugging.

Inherited from​

DeviceResource.id


indexBuffer​

indexBuffer: Buffer | null = null

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:43

Index buffer


maxVertexAttributes​

readonly maxVertexAttributes: number

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:40

Max number of vertex attributes


props​

readonly props: Required<Props>

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:123

The props that this resource was created with

Inherited from​

DeviceResource.props


userData​

readonly userData: Record<string, unknown> = {}

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:125

User data object, reserved for the application

Inherited from​

DeviceResource.userData


defaultProps​

static defaultProps: Required<VertexArrayProps>

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:29

Default properties for resource

Overrides​

DeviceResource.defaultProps

Accessors​

[toStringTag]​

Get Signature​

get [toStringTag](): string

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:35

Returns​

string

Overrides​

DeviceResource.[toStringTag]


destroyed​

Get Signature​

get destroyed(): boolean

Defined in: modules/core/src/api/adapter/resources/resource.ts:27

Whether destruction has completed, including when cleanup reported an error.

Returns​

boolean

Inherited from​

DeviceResource.destroyed


isHandleBorrowed​

Get Signature​

get isHandleBorrowed(): boolean

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:146

Whether luma.gl may only reference the opaque externally owned resource handle.

Returns​

boolean

Inherited from​

DeviceResource.isHandleBorrowed


ownedResources​

Get Signature​

get ownedResources(): readonly Resource[]

Defined in: modules/core/src/api/adapter/resources/resource.ts:22

A snapshot of this resource's children. Mutating the snapshot cannot change ownership.

Returns​

readonly Resource[]

Inherited from​

DeviceResource.ownedResources


owner​

Get Signature​

get owner(): Resource | null

Defined in: modules/core/src/api/adapter/resources/resource.ts:17

The resource responsible for destroying this resource, or null for caller-managed lifetime.

Returns​

Resource | null

Inherited from​

DeviceResource.owner


ownsHandle​

Get Signature​

get ownsHandle(): boolean

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:139

Whether luma.gl created and owns the underlying resource handle.

Returns​

boolean

Inherited from​

DeviceResource.ownsHandle

Methods​

[dispose]()​

[dispose](): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:50

Destroy the resource when leaving a using scope.

Returns​

void

Inherited from​

DeviceResource.[dispose]


attachResource()​

attachResource(resource): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:96

Parameters​

resource​

Resource

Returns​

void

Deprecated​

Use resource.transferOwnershipTo(this).

Inherited from​

DeviceResource.attachResource


bindBeforeRender()​

abstract bindBeforeRender(renderPass): void

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:71

Applies any backend-specific bindings required before a draw call.

Parameters​

renderPass​

RenderPass

Returns​

void


delete()​

delete(): this

Defined in: modules/core/src/api/adapter/resources/resource.ts:90

Returns​

this

Deprecated​

Use destroy().

Inherited from​

DeviceResource.delete


destroy()​

destroy(): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:55

Destroy children before this resource. Subclasses implement hooks instead of overriding.

Returns​

void

Inherited from​

DeviceResource.destroy


destroyAttachedResource()​

destroyAttachedResource(resource): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:108

Parameters​

resource​

Resource

Returns​

void

Deprecated​

Check resource.owner and call resource.destroy().

Inherited from​

DeviceResource.destroyAttachedResource


destroyAttachedResources()​

destroyAttachedResources(): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:115

Returns​

void

Deprecated​

Destroy individually owned resources, or destroy the owner.

Inherited from​

DeviceResource.destroyAttachedResources


detachResource()​

detachResource(resource): void

Defined in: modules/core/src/api/adapter/resources/resource.ts:101

Parameters​

resource​

Resource

Returns​

void

Deprecated​

Use resource.transferOwnershipTo(null). Only detaches a child owned by this.

Inherited from​

DeviceResource.detachResource


getBufferSlot()​

getBufferSlot(bufferName): number | null

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:76

Returns the backend-defined slot for a logical buffer name, if known.

Parameters​

bufferName​

string

Returns​

number | null


getDrawValidationError()​

getDrawValidationError(): string | null

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:81

Returns a draw-blocking validation error, or null if this vertex array can be drawn.

Returns​

string | null


getProps()​

getProps(): object

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:174

Combines a map of user props and default props, only including props from defaultProps

Returns​

object

returns a map of overridden default props

Inherited from​

DeviceResource.getProps


setBuffer()​

abstract setBuffer(bufferSlot, buffer, byteOffset?): void

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:68

Sets one backend-defined buffer slot or attribute location.

Parameters​

bufferSlot​

number

buffer​

Buffer | null

byteOffset?​

number

Byte offset added to every attribute read from this buffer, for example when the buffer is shared and the vertex data starts inside it. Defaults to 0.

Returns​

void


setConstantWebGL()​

setConstantWebGL(location, value): void

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:88

Parameters​

location​

number

value​

TypedArray | null

Returns​

void

Deprecated​

Set constant attributes (WebGL only)


setIndexBuffer()​

abstract setIndexBuffer(indices): void

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:62

Sets the index buffer used for indexed rendering.

Parameters​

indices​

Buffer | null

Returns​

void


toJSON()​

toJSON(): string

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:116

Compact serialization for assertion diffs and structured debug logs.

Returns​

string

Inherited from​

DeviceResource.toJSON


toString()​

toString(): string

Defined in: modules/core/src/api/adapter/resources/device-resource.ts:111

Returns a string representation of an object.

Returns​

string

Inherited from​

DeviceResource.toString


transferOwnershipTo()​

transferOwnershipTo(owner): this

Defined in: modules/core/src/api/adapter/resources/resource.ts:32

Transfer exclusive ownership, or return lifetime responsibility to the caller with null.

Parameters​

owner​

Resource | null

Returns​

this

Inherited from​

DeviceResource.transferOwnershipTo


unbindAfterRender()​

abstract unbindAfterRender(renderPass): void

Defined in: modules/core/src/api/adapter/resources/vertex-array.ts:73

Clears any backend-specific bindings after a draw call.

Parameters​

renderPass​

RenderPass

Returns​

void