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.
Properties
Section titled “Properties”height
Section titled “height”
readonlyheight:number
Defined in: renderer/src/RenderTarget.ts:63
Buffer height in source coordinates.
needsRender
Section titled “needsRender”
readonlyneedsRender:boolean
Defined in: renderer/src/RenderTarget.ts:67
Whether a render is pending.
resolution
Section titled “resolution”
readonlyresolution:number
Defined in: renderer/src/RenderTarget.ts:65
Texels per source pixel actually allocated — the renderer’s resolution times resolutionScale.
source
Section titled “source”
readonlysource:DisplayContainer
Defined in: renderer/src/RenderTarget.ts:59
The container drawn into the buffer.
texture
Section titled “texture”
readonlytexture:TextureResource
Defined in: renderer/src/RenderTarget.ts:57
The texture the buffer draws into. Show it with a SpriteComponent, a mask, or a filter.
readonlywidth:number
Defined in: renderer/src/RenderTarget.ts:61
Buffer width in source coordinates.
Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
void
Defined in: renderer/src/RenderTarget.ts:92
Destroy the texture and its GPU memory. Safe to call repeatedly.
Returns
Section titled “Returns”void
invalidate()
Section titled “invalidate()”invalidate():
void
Defined in: renderer/src/RenderTarget.ts:70
Mark the buffer stale so the next renderIfNeeded redraws it.
Returns
Section titled “Returns”void
render()
Section titled “render()”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.
Returns
Section titled “Returns”void
renderIfNeeded()
Section titled “renderIfNeeded()”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.
Returns
Section titled “Returns”boolean
resize()
Section titled “resize()”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.
Parameters
Section titled “Parameters”number
height
Section titled “height”number
resolutionScale?
Section titled “resolutionScale?”number
Returns
Section titled “Returns”void