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)

Constructors

Properties

Accessors

Methods

Constructors

Properties

context: Context

The rendering context.

Accessors

  • get drawBuffers(): (number | boolean)[]
  • The current draw buffers. false represents no buffer, true represents the back buffer, and an integer represents the corresponding color buffer.

    Returns (number | boolean)[]

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

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

    • value: (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_: undefined

      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.

  • 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.

  • 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.