Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DefaultFramebuffer

Default framebuffer with framebuffer interface. It is intended for use as default buffer binding and enables lazy target size reconfiguration of stages.

this._someStage.frame(this._nullFBO, frameNumber, multiFrameNumber);

Note that this buffer does query its size from the current context's canvas.

Hierarchy

Index

Constructors

constructor

Properties

Protected _buffersByAttachment

_buffersByAttachment: Map<number, Renderbuffer> = ...

Access to all attached renderbuffer objects.

Protected _clearColors

_clearColors: GLclampf4[]

Protected _clearDepth

_clearDepth: number

RGBA color, depth value, or stencil value used for clearing the associated buffer.

Protected _clearStencil

_clearStencil: number

Protected _colorClearQueue

_colorClearQueue: number[] = ...

Queue of all draw buffers that are to be cleared on clear.

Protected _context

_context: Context
see

context

Protected _drawBuffers

_drawBuffers: number[] = ...

Protected _drawBuffersChanged

_drawBuffersChanged: boolean = false

Protected _identifier

_identifier: string

Protected _object

_object: undefined | WebGLFramebuffer
see

object

Protected _referenceCount

_referenceCount: number = 0

Number of references to this object. If at least a single reference was counted, this object can neither be initialized (and thus created) nor uninitialized (and thus deleted). The reference count is controlled via ref() and unref() functions.

Protected _texturesByAttachment

_texturesByAttachment: Map<number, Texture2D> = ...

Access to all attached texture objects.

Protected _valid

_valid: boolean = false
see

valid

Protected assertInitialized

assertInitialized: () => void = ...

Asserts the objects initialization status to be true. Note that the implementation is cached and forwarded to either an empty function when initialized and to an acutal assert(false) otherwise.

Type declaration

    • (): void
    • Returns void

Protected assertUninitialized

assertUninitialized: () => void = ...

Asserts the objects initialization status to be false. Note that the implementation is cached and forwarded to either an empty function when uninitialized and to an acutal assert(false) otherwise.

Type declaration

    • (): void
    • Returns void

clear

clear: (mask: number, bind?: boolean, unbind?: boolean, colorClearQueue?: number[]) => void

Depending on the webgl version and provided bitmask, clears attachments of the framebuffer. Note that this function is set/unset to es2Clear or es3Clear on initialization/uninitialization.

param

Bitmask specifying which bits are to be cleared (and thereby which attachments).

param

Allows to skip binding the framebuffer (e.g., when binding is handled outside).

param

Allows to skip unbinding the framebuffer (e.g., when binding is handled outside).

param

allows to specify a specific queue of color attachments to be cleared. The webgl1 implementation ignores this parameter. If no parameter is given, the webgl2 implementation clears all color attachments.

Type declaration

    • (mask: number, bind?: boolean, unbind?: boolean, colorClearQueue?: number[]): void
    • Parameters

      • mask: number
      • Optional bind: boolean
      • Optional unbind: boolean
      • Optional colorClearQueue: number[]

      Returns void

Static Readonly DEFAULT_FRAMEBUFFER

DEFAULT_FRAMEBUFFER: undefined = ...

Default framebuffer, e.g., used for unbind.

Accessors

context

  • Read-only access to the objects context, used to get context information and WebGL API access.

    Returns Context

drawBuffers

  • get drawBuffers(): number[]
  • set drawBuffers(attachments: number[]): void
  • Used to remember which attachments are available as potential draw buffers.

    Returns number[]

  • Set one or multiple draw buffers.

    Parameters

    • attachments: number[]

      Array of attachment identifier (e.g., gl.COLOR_ATTACHMENT0).

    Returns void

height

  • get height(): number

identifier

  • get identifier(): string
  • Every GPU asset that allocates memory should provide a human readable identifier for GPU allocation tracking and debugging purposes. Please note that the identifier might changed on initialization due to the generation and assignment of a unique identifier.

    Returns string

    • This assets identifier used for gpu allocation tracking and debugging.

initialized

  • get initialized(): boolean
  • Property getter for readonly access to the initialization status of an initializable instance.

    Returns boolean

object

  • get object(): T

size

valid

  • get valid(): boolean
  • Cached object status used to derive validity when initialized.

    Returns boolean

    • True if the object status is complete, false otherwise.

width

  • get width(): number

Methods

bind

  • bind(target?: number): void

clearColor

  • override

    Sets the clear color used for clearing the default color buffer. In order to have transparency working, the canvas needs to have the alpha attribute enabled. This stage also supports premultiplied alpha, which is applied automatically when the context's premultipliedAlpha attribute is set.

    Parameters

    Returns void

clearDepth

  • clearDepth(depth: number): void

clearStencil

  • clearStencil(stencil: number): void

Protected create

  • create(): undefined | WebGLFramebuffer

Protected delete

  • delete(): void

Protected es2Clear

  • es2Clear(mask: number, bind?: boolean, unbind?: boolean): void
  • WebGL1 implementation for clearing framebuffer attachments.

    Parameters

    • mask: number

      A GLbitfield bitwise OR mask that indicates the buffers to be cleared.

    • bind: boolean = true

      Allows to skip binding the framebuffer (e.g., when binding is handled outside).

    • unbind: boolean = true

      Allows to skip unbinding the framebuffer (e.g., when binding is handled outside).

    Returns void

Protected es3Clear

  • es3Clear(mask: number, bind?: boolean, unbind?: boolean, colorClearQueue?: number[]): void
  • WebGL2 implementation for clearing framebuffer attachments.

    Parameters

    • mask: number

      A GLbitfield bitwise OR mask that indicates the buffers to be cleared.

    • bind: boolean = true

      Allows to skip binding the framebuffer (e.g., when binding is handled outside).

    • unbind: boolean = true

      Allows to skip unbinding the framebuffer (e.g., when binding is handled outside).

    • Optional colorClearQueue: number[]

      Allows to specify a specific queue of color attachments to be cleared. If no parameter is given, the webgl2 implementation clears all color attachments.

    Returns void

Protected hasAttachment

  • hasAttachment(attachment: number): boolean

initialize

  • initialize(...args: any[]): boolean
  • override

    Ensure that an object handle is created at the point of initialization. When overriding this function super.initialize() has to be invoked immediately/first. Please note that initialization of invalid object raises an assertion in order to prevent further actions without a valid WebGL object. After object creation the valid property is expected to be set accordingly.

    Parameters

    • Rest ...args: any[]

    Returns boolean

ref

  • ref(): void

resize

  • resize(): void

texture

  • texture(attachment: number): undefined | Texture2D
  • Access to attached textures, identified by a valid framebuffer attachment.

    Parameters

    • attachment: number

      The attachment to request the texture object of.

    Returns undefined | Texture2D

    • A texture object if one exists for the given attachment, otherwise undefined.

unbind

  • unbind(target?: number): void
  • Binds the default back buffer as framebuffer to the provided target.

    Parameters

    • target: number = ...

      Specifying the binding point (target).

    Returns void

uninitialize

  • uninitialize(): void
  • override

    Ensure that an object handle is deleted, invalidated, and its allocated GPU resources are set to zero. When overriding this function super.uninitialize() has to be invoked last/at the end. Note that an object cannot be uninitialized if it is referenced (reference count > 0).

    Returns void

unref

  • unref(): void

Static Protected Readonly assertInitializedFalse

Static Protected Readonly assertUninitializedFalse

Static assert_initialized

  • assert_initialized(): MethodDecorator

Static assert_uninitialized

  • assert_uninitialized(): MethodDecorator

Static discard

  • discard(): MethodDecorator
  • Method decorator for discarding of Initializable inheritors. This decorator asserts the initialization status of the instance that is to be discarded, invokes its uninitialization, and falsifies the initialization status. In order to encourage the use of assertInitialized and assertUninitialized they are dynamically bound to a static, always-failing assert and an empty/undefined function respectively.

    Returns MethodDecorator

Static initialize

  • initialize(): MethodDecorator
  • Method decorator for initialization of Initializable inheritors. This decorator asserts the initialization status of the instance that is to be initialized, invokes its initialization with arbitrary number of parameters, and sets the initialization status to the initialization success (either false or true). In order to encourage the use of assertInitialized and assertUninitialized they are dynamically bound to either a static, always-failing assert or an empty/undefined function.

    Returns MethodDecorator

Static Protected statusString

  • statusString(context: Context, status: number): string

Static uninitialize

  • uninitialize(): MethodDecorator
  • Method decorator for uninitialization of Initializable inheritors. This decorator asserts the initialization status of the instance that is to be uninitialized, invokes its uninitialization, and falsifies the initialization status. In order to encourage the use of assertInitialized and assertUninitialized they are dynamically bound to a static, always-failing assert and an empty/undefined function respectively.

    Returns MethodDecorator