Skip to content

RenderTargetHandle

Defined in: renderer/src/RenderTarget.ts:55

An offscreen texture the game draws into on its own schedule, returned by RendererPlugin.createRenderTarget.

The buffer starts out needing a render and is redrawn only when the game asks — call renderIfNeeded every frame and invalidate whenever the source content changes, or call render directly for a buffer that must follow moving content.

Drawing happens in the source container’s own coordinate space: a child at local (100, 50) lands at texture pixel (100, 50). Ancestor transforms do not reach the buffer, so neither the camera nor the responsive-fit scale moves or scales what is drawn. Position the source’s children in the space you want the texture to hold.

Keep the source out of the live scene graph. Pixi promotes a rendered container to a render group, which changes how it batches where it is parented, and content drawn into a buffer is normally shown through the buffer’s texture rather than twice.

readonly height: number

Defined in: renderer/src/RenderTarget.ts:63

Buffer height in source coordinates.


readonly needsRender: boolean

Defined in: renderer/src/RenderTarget.ts:67

Whether a render is pending.


readonly resolution: number

Defined in: renderer/src/RenderTarget.ts:65

Texels per source pixel actually allocated — the renderer’s resolution times resolutionScale.


readonly source: DisplayContainer

Defined in: renderer/src/RenderTarget.ts:59

The container drawn into the buffer.


readonly texture: TextureResource

Defined in: renderer/src/RenderTarget.ts:57

The texture the buffer draws into. Show it with a SpriteComponent, a mask, or a filter.


readonly width: number

Defined in: renderer/src/RenderTarget.ts:61

Buffer width in source coordinates.

destroy(): void

Defined in: renderer/src/RenderTarget.ts:92

Destroy the texture and its GPU memory. Safe to call repeatedly.

void


invalidate(): void

Defined in: renderer/src/RenderTarget.ts:70

Mark the buffer stale so the next renderIfNeeded redraws it.

void


render(): void

Defined in: renderer/src/RenderTarget.ts:77

Draw the source into the buffer now and clear the pending flag. Does nothing while the source is hidden (visible === false); the request stays pending so the buffer catches up once it is shown.

void


renderIfNeeded(): boolean

Defined in: renderer/src/RenderTarget.ts:83

Draw the source only when a render is pending. Returns whether it drew, so a caller can skip downstream work on an unchanged buffer.

boolean


resize(width, height, resolutionScale?): void

Defined in: renderer/src/RenderTarget.ts:89

Resize the buffer and mark it stale. Anything already showing the texture picks up the new size on its next draw.

number

number

number

void