RenderTexture class Rendering

An offscreen render target a RenderView can render into.

Create one, set it as a view's RenderView.target, and add the view to Scene.views; the scene renders it (subject to update) whenever the scene itself renders. Display it in the widget tree with a RenderTextureView, or assign it to a material texture slot (for example PhysicallyBasedMaterial.baseColorTexture or UnlitMaterial.baseColorTexture) to show the live capture on scene geometry, the security-camera/monitor/mirror pattern. Material sampling uses sampling.

The texture holds the same display-referred premultiplied image a screen view shows (tone mapping and anti-aliasing applied), sized at exactly width x height physical pixels.

The engine owns the GPU textures behind this handle (a small ring, so writing a new frame never races a still-displayed previous frame). Consumers hold the RenderTexture itself and resolve texture when they draw; notifications fire after each re-render.

Texture-target views render in RenderView.order before the screen views, and texture always returns the most recently completed frame. So a consumer drawn after this target's producing view samples this frame's capture, while a consumer visible inside the capture (including the target sampling itself, a mirror facing a mirror) samples the previous frame instead of forming a feedback loop.

Inheritance
Implemented types

Constructors

RenderTexture({required int width, required int height, RenderTextureUpdate update = RenderTextureUpdate.everyFrame, RenderTextureSampling sampling = const RenderTextureSampling()})
Creates a render target of width x height physical pixels.

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
height → int
The target height in physical pixels.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sampledSampler → SamplerOptions
The sampler this source is bound with.
no setteroverride
sampledTexture → Texture?
The GPU texture to sample this frame, or null when none is available yet (a live source before its first frame; callers substitute a placeholder).
no setteroverride
sampling ↔ RenderTextureSampling
Sampling options used when a material samples this target.
getter/setter pair
texture → Texture?
The most recently completed frame, or null before the first render.
no setter
update ↔ RenderTextureUpdate
When this target re-renders. See RenderTextureUpdate.
getter/setter pair
width → int
The target width in physical pixels.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
requestUpdate() → void
With RenderTextureUpdate.manual, renders once on the scene's next frame. Has no effect with the other policies (they re-render on their own schedule).
resize(int width, int height) → void
Reallocates the target at a new size. Consumers pick up the new textures on the next render; the next update check re-renders regardless of policy so the target is never displayed stale-sized.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited