@lakuna/ugl
    Preparing search index...

    Class Framebuffer

    A portion of contiguous memory that contains a collection of buffers that store color, alpha, depth, and stencil information that is used to render an image.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    context: Context

    The rendering context.

    Accessors

    • get drawBuffers(): readonly (number | boolean)[]

      The current draw buffers. false represents no buffer, true represents the back buffer, and an integer represents the corresponding color buffer.

      Returns readonly (number | boolean)[]

      BadValueError if too many draw buffers are specified for the current environment.

    • set drawBuffers(value: readonly (number | boolean)[]): void

      Parameters

      • value: readonly (number | boolean)[]

      Returns void

    • get readBuffer(): number | boolean

      The current read buffer. false represents no buffer, true represents the back buffer, and an integer represents the corresponding color buffer.

      Returns number | boolean

    • set readBuffer(value: number | boolean): void

      Parameters

      • value: number | boolean

      Returns void

    Methods

    • Attach a 2D texture to this framebuffer.

      Parameters

      • attachment: number

        Specify the depth attachment, the stencil attachment, the depth stencil attachment, or the index of a color attachment.

      • texture: Texture2d

        The texture to attach.

      • Optional_: unknown

        An unused value.

      • Optionallevel: number

        The level of the texture to attach. Defaults to the top level.

      • Optionallayer: number

        The layer of the texture to attach, or undefined for the entire texture.

      Returns void

      BadValueError if the size of the texture does not match the size of any existing attachment to the framebuffer.

      Error if this object represents the default framebuffer.

    • Attach a face of a cubemapped texture to this framebuffer.

      Parameters

      • attachment: number

        Specify the depth attachment, the stencil attachment, the depth stencil attachment, or the index of a color attachment.

      • texture: TextureCubemap

        The texture to attach.

      • face: CubeFace

        The face of the cubemapped texture to attach.

      • Optionallevel: number

        The level of the texture to attach. Defaults to the top level.

      • Optionallayer: number

        The layer of the texture to attach, or undefined for the entire texture.

      Returns void

      BadValueError if the size of the texture does not match the size of any existing attachment to the framebuffer.

      Error if this object represents the default framebuffer.

    • Attach a renderbuffer to this framebuffer.

      Parameters

      • attachment: number

        Specify the depth attachment, the stencil attachment, the depth stencil attachment, or the index of a color attachment.

      • renderbuffer: Renderbuffer

        The renderbuffer to attach.

      Returns void

      BadValueError if the size of the renderbuffer does not match the size of any existing attachment to the framebuffer.

      Error if this object represents the default framebuffer.

    • Clear the specified buffers to the specified values.

      Parameters

      • color: boolean | Color = true

        The value to clear the color buffer to or a boolean to use the previous clear color.

      • depth: number | boolean = true

        The value to clear the depth buffer to or a boolean to use the previous clear depth.

      • stencil: number | boolean = true

        The value to clear the stencil buffer to or a boolean to use the previous clear stencil.

      Returns void

      clear

    • Draw the vertex data contained within a vertex array object.

      Parameters

      • vao: VertexArray

        The vertex array object that contains the data to be drawn.

      • Optionaluniforms: UniformMap

        A collection of uniform values to set prior to rasterization.

      • primitive: Primitive = Primitive.TRIANGLES

        The type of primitive to rasterize.

      • offset: number = 0

        The number of elements to skip when rasterizing arrays, or the number of indices to skip when rasterizing elements.

      • OptionalcountOverride: number

        The number of indices or elements to be rendered. Automatically renders all supplied data if undefined.

      Returns void

      BadValueError if a uniform is passed undefined as a value or if an unknown uniform is specified.

    • Read pixels from this framebuffer.

      Parameters

      • Optionalrectangle: Rectangle

        The rectangle of pixels to read. Defaults to the entire read buffer.

      • Optionalrgba: boolean

        Whether to output RGBA data (as opposed to using the format of the read buffer). Defaults to false.

      • OptionalpackAlignment: 1 | 2 | 4 | 8

        The alignment to use when packing the data, or undefined to let this be automatically determined.

      • Optionalout: undefined

        The buffer or typed array to store the pixel data in.

      • Optionaloffset: number

        The offset at which to start storing pixel data in the buffer or typed array.

      Returns ArrayBufferView

      A typed array of pixel data.

    • Read pixels from this framebuffer.

      Type Parameters

      Parameters

      • rectangle: undefined | Rectangle

        The rectangle of pixels to read. Defaults to the entire read buffer.

      • rgba: undefined | boolean

        Whether to output RGBA data (as opposed to using the format of the read buffer). Defaults to false.

      • packAlignment: undefined | 1 | 2 | 4 | 8

        The alignment to use when packing the data, or undefined to let this be automatically determined.

      • out: T

        The buffer or typed array to store the pixel data in.

      • Optionaloffset: number

        The offset at which to start storing pixel data in the buffer or typed array.

      Returns T

      The buffer or typed array to store the pixel data in.

      Error if the given buffer or typed array is too small to store the selected data.