Represents a WebGL render buffer with optional depth texture and MRT support. Internally manages a framebuffer + one or more color textures and an optional depth attachment (either a texture or a renderbuffer).

Notes:

  • Framebuffer completeness is checked while bound.
  • Resizes lazily via touch() when size or drawingBuffer changes.
  • Provides small wrapper objects compatible with WebGLAbstractTexture for sampling the color/depth textures.
  • allocated is derived from internal state (getter) instead of a manual flag.

Constructors

  • Creates a WebGLRenderBuffer.

    Parameters

    • canvas: HTMLCanvasElement
    • gl: WebGL2RenderingContext
    • options: { depthTexture: boolean; size?: readonly [number, number] }

    Returns WebGLRenderBuffer

Properties

bound: boolean = false
canvas: HTMLCanvasElement
size?: readonly [number, number]

Accessors

Methods

  • Read a single pixel from the given color attachment (default 0).

    Parameters

    • pickX: number
    • pickY: number
    • glFormat: number = null
    • glType: number = null
    • arrayType: TypedArrayConstructor = Uint8Array
    • arrayMultiplier: number = 4
    • colorBufferIndex: number = 0

    Returns any

  • Read the entire color attachment into a typed array.

    Parameters

    • glFormat: number = null
    • glType: number = null
    • arrayType: TypedArrayConstructor = Uint8Array
    • arrayMultiplier: number = 4
    • colorBufferIndex: number = 0

    Returns any

  • Returns a data URL (png/jpeg/bmp) of the current contents.

    Parameters

    • params: { format?: string; height?: number; width?: number } = {}

    Returns string