Skip to main content

QuadIndexBuffer

Helper that defines and index buffer for quad geometry

Index buffers allow you to save space in vertex buffers when you share vertices in geometry it is almost always worth it in terms of performance to use an index buffer.

Index

Constructors

constructor

  • new QuadIndexBuffer(gl: WebGL2RenderingContext, numberOfQuads: number, useUint16?: boolean): QuadIndexBuffer
  • Parameters

    • gl: WebGL2RenderingContext

      WebGL2RenderingContext this layout will be attached to, these cannot be reused across contexts.

    • numberOfQuads: number

      Specify the max number of quads you want to draw

    • optionaluseUint16: boolean

      Optionally force a uint16 buffer

    Returns QuadIndexBuffer

Properties

publicbuffer

buffer: WebGLBuffer

Access to the webgl buffer handle

publicbufferData

bufferData: Uint16Array | Uint32Array

Access to the raw data of the index buffer

publicbufferGlType

bufferGlType: number

Depending on the browser this is either gl.UNSIGNED_SHORT or gl.UNSIGNED_INT

Accessors

publicsize

  • get size(): number
  • Returns number

Methods

publicbind

  • bind(): void
  • Bind this index buffer


    Returns void

publicdispose

  • dispose(): void
  • Returns void

publicupload

  • upload(): void
  • Upload data to the GPU


    Returns void