Skip to main content

Class: PingPongTarget

Defined in: rendering/ping-pong-target.ts:13

A pair of render targets that can be flipped between a "read" and a "write" target, for passes that repeatedly sample the previous pass's output while writing into a separate buffer (e.g. multi-step post-processing effects).

Constructors​

Constructor​

new PingPongTarget(gl, width, height, format?): PingPongTarget

Defined in: rendering/ping-pong-target.ts:25

Creates a new PingPongTarget, allocating two render targets of the given size.

Parameters​

gl​

WebGL2RenderingContext

The WebGL2 rendering context.

width​

number

The render target width in pixels.

height​

number

The render target height in pixels.

format?​

RENDER_TARGET_FORMAT_KEYS = RENDER_TARGET_FORMAT.ldr

The requested color storage format for both underlying render targets. Defaults to RENDER_TARGET_FORMAT.ldr.

Returns​

PingPongTarget

Accessors​

read​

Get Signature​

get read(): RenderTarget

Defined in: rendering/ping-pong-target.ts:40

The render target that should be sampled from by the current pass.

Returns​

RenderTarget


write​

Get Signature​

get write(): RenderTarget

Defined in: rendering/ping-pong-target.ts:47

The render target that the current pass should write into.

Returns​

RenderTarget

Methods​

dispose()​

dispose(gl): void

Defined in: rendering/ping-pong-target.ts:78

Deletes both render targets, freeing their GPU resources.

Parameters​

gl​

WebGL2RenderingContext

The WebGL2 rendering context.

Returns​

void


resize()​

resize(gl, width, height): void

Defined in: rendering/ping-pong-target.ts:65

Resizes both render targets.

Parameters​

gl​

WebGL2RenderingContext

The WebGL2 rendering context.

width​

number

The new render target width in pixels.

height​

number

The new render target height in pixels.

Returns​

void


swap()​

swap(): void

Defined in: rendering/ping-pong-target.ts:55

Flips the read and write targets, so the target just written to becomes the target the next pass reads from.

Returns​

void