Rapid Render API
    Preparing search index...

    Class RenderTexture

    A texture that can be rendered to (wraps a WebGL Framebuffer).

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _ph: number = 0
    _pw: number = 0
    _px: number = 0
    _py: number = 0
    clearColor?: Color
    flipY: boolean = true
    glTexture: WebGLTexture | null = null
    isAtlas: boolean = false
    isRotated: boolean = false
    offsetX: number = 0
    offsetY: number = 0
    rawHeight: number = 0
    rawWidth: number = 0
    scale: number = 1
    uvH: number = 1
    uvW: number = 1
    uvX: number = 0
    uvY: number = 0

    Accessors

    • get height(): number

      Returns number

    • get width(): number

      Returns number

    Methods

    • Activates this texture as the current render target.

      Parameters

      • clear: boolean = false

        Whether to clear the render target after activation.

      Returns void

    • Deactivates this texture, returning rendering to the default frame buffer.

      Returns void

    • Get the color at a pixel in the render texture.

      Parameters

      • x: number

        X coordinate in logical pixel space (top-left origin).

      • y: number

        Y coordinate in logical pixel space (top-left origin).

      Returns Color

    • Get raw pixels from the render texture.

      Parameters

      • x: number = 0

        X coordinate in logical pixel space (top-left origin).

      • y: number = 0

        Y coordinate in logical pixel space (top-left origin).

      • width: number = ...

        Width of the region to read.

      • height: number = ...

        Height of the region to read.

      Returns Uint8Array

    • Creates a new Texture representing a sub-region of this Texture.

      Parameters

      • x: number

        The x coordinate in pixels, relative to this texture's logical start.

      • y: number

        The y coordinate in pixels, relative to this texture's logical start.

      • width: number

        The width of the sub-texture in pixels.

      • height: number

        The height of the sub-texture in pixels.

      Returns Texture

      A new Texture pointing to the sub-region.

    • Resizes the render texture using a grow-only GPU allocation strategy.

      • GPU memory is only reallocated when the new size exceeds the current allocation.
      • Shrinking only updates the logical dimensions and UV sub-region — no GPU work.

      This makes it safe to call every frame with varying sizes (e.g. inside applyFilters).

      Parameters

      • width: number

        New logical width.

      • height: number

        New logical height.

      • force: boolean = false

        Force full GPU reallocation regardless of current allocation size.

      Returns void

    • Sets the visible region (clipping) in pixels relative to the BaseTexture.

      Parameters

      • x: number

        The x coordinate in pixels.

      • y: number

        The y coordinate in pixels.

      • w: number

        The width in pixels.

      • h: number

        The height in pixels.

      Returns this

      The current Texture instance.

    • Utility to split this texture into a grid of sprite textures. Sub-textures will respect the current UV offsets.

      Parameters

      • cellWidth: number

        The width of each cell in pixels.

      • cellHeight: number

        The height of each cell in pixels.

      • Optionalcols: number

        Optional number of columns. Truncates based on texture width if omitted.

      • Optionalrows: number

        Optional number of rows. Truncates based on texture height if omitted.

      • gap: number = 0

        Optional pixel gap between cells.

      Returns Texture[]

      An array of split Textures.