Skip to main content

VertexLayout

Helper around creating vertex attributes in a given [[VertexBuffer]], this is useful for describing the memory layout for your vertices inside a particular buffer

Note: This helper assumes interleaved attributes in one [[VertexBuffer]], not many.

Working with gl.vertexAttribPointer can be tricky, and this attempts to double check you

Index

Constructors

constructor

Accessors

publicattributes

  • get attributes(): readonly [name: string, numberOfComponents: number][]
  • Returns readonly [name: string, numberOfComponents: number][]

publicshader

publictotalVertexSizeBytes

  • get totalVertexSizeBytes(): number
  • Total number of bytes that the vertex will take up


    Returns number

publicvertexBuffer

Methods

initialize

  • initialize(): void
  • Layouts need shader locations and must be bound to a shader


    Returns void

use

  • use(uploadBuffer?: boolean, count?: number): void
  • Bind this layout with it's associated vertex buffer


    Parameters

    • uploadBuffer: boolean = false

      Optionally indicate you wish to upload the buffer to the GPU associated with this layout

    • optionalcount: number

    Returns void