PIXI.Framebuffer

class Framebuffer

A framebuffer can be used to render contents off of the screen. PIXI.BaseRenderTexture uses one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.

On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.

Constructor


new PIXI.Framebuffer(width: number, height: number) → {}
Parameters:
Name Type Description
width number

Width of the frame buffer

height number

Height of the frame buffer

Summary


Properties from Framebuffer

PIXI.BaseTexture
colorTexture
number
height

Height of framebuffer in pixels.

PIXI.MSAA_QUALITY
multisample = PIXI.MSAA_QUALITY.NONE

Desired number of samples for antialiasing. 0 means AA should not be used.

number
width

Width of framebuffer in pixels.

Methods from Framebuffer

this
addColorTexture(index: number, texture: PIXI.BaseTexture)
this
addDepthTexture(texture: PIXI.BaseTexture)
void
destroyDepthTexture()

Destroys and removes the depth texture added to this framebuffer.

void
dispose()

Disposes WebGL resources that are connected to this geometry.

this
enableDepth()

Enable depth on the frame buffer.

this
enableStencil()

Enable stencil on the frame buffer.

void
resize(width: number, height: number)

Public Properties


colorTexture Framebuffer.ts:75
colorTexture: PIXI.BaseTexture

Reference to the colorTexture.

height Framebuffer.ts:20
height: number

Height of framebuffer in pixels.

multisample Framebuffer.ts:23
multisample: PIXI.MSAA_QUALITY = PIXI.MSAA_QUALITY.NONE

Desired number of samples for antialiasing. 0 means AA should not be used.

Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures. Antialiasing is the same as for main buffer with renderer antialias:true options. Seriously affects GPU memory consumption and GPU performance.

 renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;
 //...
 renderer.render(myContainer, {renderTexture});
 renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture
width Framebuffer.ts:17
width: number

Width of framebuffer in pixels.

Public Methods


addColorTexture Framebuffer.ts:84
addColorTexture(index: number, texture: PIXI.BaseTexture) → {this}

Add texture to the colorTexture array.

Parameters:
Name Type Attributes Default Description
index number 0

Index of the array to add the texture to

texture PIXI.BaseTexture

<optional>

Texture to add to the array

Returns:
Type Description
this
addDepthTexture Framebuffer.ts:106
addDepthTexture(texture: PIXI.BaseTexture) → {this}

Add a depth texture to the frame buffer.

Parameters:
Name Type Attributes Description
texture PIXI.BaseTexture

<optional>

Texture to add.

Returns:
Type Description
this
destroyDepthTexture Framebuffer.ts:192
destroyDepthTexture() → {void}

Destroys and removes the depth texture added to this framebuffer.

Returns:
Type Description
void
dispose Framebuffer.ts:186
dispose() → {void}

Disposes WebGL resources that are connected to this geometry.

Returns:
Type Description
void
enableDepth Framebuffer.ts:129
enableDepth() → {this}

Enable depth on the frame buffer.

Returns:
Type Description
this
enableStencil Framebuffer.ts:140
enableStencil() → {this}

Enable stencil on the frame buffer.

Returns:
Type Description
this
resize Framebuffer.ts:151
resize(width: number, height: number) → {void}

Resize the frame buffer

Parameters:
Name Type Description
width number

Width of the frame buffer to resize to

height number

Height of the frame buffer to resize to

Returns:
Type Description
void

Powered by webdoc!