pixi.js
    Preparing search index...

    Class GlBufferSystemAdvanced

    System plugin to the renderer to manage buffers.

    WebGL uses Buffers as a way to store objects to the GPU. This system makes working with them a lot easier.

    Buffers are used in three main places in WebGL

    • geometry information
    • Uniform information (via uniform buffer objects - a WebGL 2 only feature)
    • Transform feedback information. (WebGL 2 only feature)

    This system will handle the binding of buffers to the GPU as well as uploading them. With this system, you never need to work directly with GPU buffers, but instead work with the Buffer class.

    A buffer is first uploaded whole when a geometry or uniform block that uses it is bound. From then on each Buffer.update() is applied as it is called, as on WebGPU, so every ranged update lands. On WebGL2 an index buffer's update goes through COPY_WRITE_BUFFER, so it changes no vertex array's index buffer.

    Implements

    Index
    • This binds specified buffer. On first run, it will create the webGL buffers for the context too

      Parameters

      • buffer: Buffer

        the buffer to bind to the renderer

      Returns void

    • Binds a whole uniform buffer to a binding slot.

      A cache is used so a buffer will not be bound again if already bound.

      Parameters

      • glBuffer: GlBuffer

        the buffer to bind

      • index: number

        the binding slot to bind it to.

      Returns void

    • Binds part of a uniform buffer to a binding slot, so it is read from the offset supplied rather than 0.

      A cache is used so a range will not be bound again if already bound.

      Parameters

      • glBuffer: GlBuffer

        the buffer to bind, which must have been uploaded

      • index: number = 0

        the binding slot to bind it to, defaults to 0

      • offset: number = 0

        the byte offset to bind at, defaults to 0. Must be a multiple of renderer.limits.minUniformBufferOffsetAlignment.

      • Optionalsize: number

        the number of bytes to bind, defaults to the rest of the buffer after offset

      Returns void

    • dispose all WebGL resources of all managed buffers

      Parameters

      • contextLost: boolean = false

      Returns void

    • Parameters

      Returns GlBuffer

    • Returns void

    • Will ensure the data in the buffer is uploaded to the GPU.

      Runs on each update event of a vertex or uniform buffer once it has a GlBuffer, and when a geometry or uniform block that uses the buffer is bound. The second call for one update is a no-op.

      Parameters

      • buffer: Buffer

        the buffer to update

      Returns GlBuffer