API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classRenderTexture

@codexo/exojs / rendering / stable

An off-screen render target that can also be sampled as a texture. Combines RenderTarget (framebuffer attachment) with the sampler parameters of a Texture (scale mode, wrap mode, mip generation). A `textureVersion` counter is incremented on every mutation so backends can detect when to re-create the underlying GPU texture object. Mipmap generation is disabled by default because render targets are typically updated every frame and mip generation is expensive.

19
props
19
methods
0
events
Import
import { RenderTexture } from '@codexo/exojs'

An off-screen render target that can also be sampled as a texture.

Combines RenderTarget (framebuffer attachment) with the sampler parameters of a Texture (scale mode, wrap mode, mip generation). A `textureVersion` counter is incremented on every mutation so backends can detect when to re-create the underlying GPU texture object.

Mipmap generation is disabled by default because render targets are typically updated every frame and mip generation is expensive.

Constructors1
new(width: number, height: number, options?: RenderTextureOptionsConstruction options for RenderTexture.): RenderTexture
Methods19
_enableDepthTexture(): void
Give this target a sampleable depth attachment. Called once, from the constructor of a subclass whose options asked for one.
_syncDepthSize(): void
Keep the depth attachment at the target's size. A subclass that resizes through a path other than resize calls this itself - a depth attachment left at the old size makes the whole framebuffer incomplete.
_touch(): void
addDestroyListener(listener: () => void): this
Subscribe to the moment this target (or any subclass - including RenderTexture) is destroyed. Backends use this to release GPU-side resources (framebuffer + attached texture) tied to the target. Listeners fire exactly once.
destroy(): void
removeDestroyListener(listener: () => void): this
Remove a previously registered destroy listener. No-op if absent.
resize(width: number, height: number): this
setGenerateMipMap(generateMipMap: boolean): this
setPremultiplyAlpha(premultiplyAlpha: boolean): this
setSize(width: number, height: number): this
setSource(source: DataView<ArrayBufferLike> | null): this
Point this target at view, or back at its own default view when passed null. The view is caller-owned - neither this call nor destroy releases it.
updateSource(): this
updateViewport(): this
Properties19
needsStencil: boolean
Whether this target needs a stencil attachment for geometric stencil clipping (RenderNode.clip with a Geometry clipShape). Set by the WebGL2 backend when such a clip is rendered into an offscreen RenderTexture, so its framebuffer gets a depth/stencil renderbuffer; the WebGL2 on-screen root uses the default framebuffer's stencil (requested at context creation), so the flag only affects offscreen WebGL2 targets. The WebGPU backend does not consult this flag: it allocates a separate depth24plus-stencil8 attachment per clipped target (root included) on demand, sized to the colour attachment's physical pixels.
Sampleable depth attachment, or null on a target that did not opt in - the on-screen root target always answers null. Opting in ({ depth: true } on a RenderTexture or a MultiRenderTarget) buys a depth buffer that survives the pass and can be read back as a texture; a MeshMaterial with writesDepth fills it. Without the opt-in a depth-writing material still draws, it just writes depth nowhere.
destroyed: boolean
true once destroy has run. A destroyed target must not be rendered into - the backend throws rather than drawing into released GPU state.
flipY: boolean
generateMipMap: boolean
height: number
powerOfTwo: boolean
Whether both dimensions are powers of two.
premultiplyAlpha: boolean
root: boolean
source: DataView<ArrayBufferLike> | null
textureVersion: number
Monotonically increasing counter incremented whenever the source data or an upload parameter changes. Filter and wrap changes do not bump it - backends resolve sampling state separately.
version: number
width: number
Source