The Renderer draws the scene and all its content onto a WebGL enabled canvas.

This renderer should be used for browsers that support WebGL.

This renderer works by automatically managing WebGLBatches, so no need for Sprite Batches or Sprite Clouds. Don't forget to add the view to your DOM or you will not see anything!

Renderer is composed of systems that manage specific tasks. The following systems are added by default whenever you create a renderer:

System Description
Generic Systems Systems that manage functionality that all renderer types share
PIXI.ViewSystem This manages the main view of the renderer usually a Canvas
PIXI.PluginSystem This manages plugins for the renderer
PIXI.BackgroundSystem This manages the main views background color and alpha
PIXI.StartupSystem Boots up a renderer and initiatives all the systems
PIXI.EventSystem This manages UI events.
WebGL Core Systems Provide an optimised, easy to use API to work with WebGL
PIXI.ContextSystem This manages the WebGL context and extensions.
PIXI.FramebufferSystem This manages framebuffers, which are used for offscreen rendering.
PIXI.GeometrySystem This manages geometries & buffers, which are used to draw object meshes.
PIXI.ShaderSystem This manages shaders, programs that run on the GPU to calculate 'em pixels.
PIXI.StateSystem This manages the WebGL state variables like blend mode, depth testing, etc.
PIXI.TextureSystem This manages textures and their resources on the GPU.
PIXI.TextureGCSystem This will automatically remove textures from the GPU if they are not used.
PIXI.MultisampleSystem This manages the multisample const on the WEbGL Renderer
PixiJS High-Level Systems Set of specific systems designed to work with PixiJS objects
PIXI.GenerateTextureSystem This adds the ability to generate textures from any PIXI.DisplayObject
PIXI.ProjectionSystem This manages the projectionMatrix, used by shaders to get NDC coordinates.
PIXI.RenderTextureSystem This manages render-textures, which are an abstraction over framebuffers.
PIXI.MaskSystem This manages masking operations.
PIXI.ScissorSystem This handles scissor masking, and is used internally by PIXI.MaskSystem
PIXI.StencilSystem This handles stencil masking, and is used internally by PIXI.MaskSystem
PIXI.FilterSystem This manages the filtering pipeline for post-processing effects.
PIXI.BatchSystem This manages object renderers that defer rendering until a flush.
PIXI.Prepare This manages uploading assets to the GPU.
PIXI.Extract This extracts image data from display objects.

The breadth of the API surface provided by the renderer is contained within these systems.

Memberof

PIXI

Hierarchy (view full)

Implements

Constructors

Properties

CONTEXT_UID: number

Unique UID assigned to the renderer's WebGL context.

_multisample: MultisampleSystem

_multisample system instance

_plugin: PluginSystem

plugin system instance

_view: ViewSystem

_view system instance

background: BackgroundSystem

background system instance

Batch system instance

buffer: BufferSystem

Buffer system instance

context: ContextSystem

Context system instance

events: EventSystem
extract: Extract
filter: FilterSystem

Filter system instance

framebuffer: FramebufferSystem

Framebuffer system instance

geometry: GeometrySystem

Geometry system instance

WebGL context, set by PIXI.ContextSystem this.context.

Member

globalUniforms: UniformGroup<Dict<any>>

Global uniforms Add any uniforms you want shared across your shaders. the must be added before the scene is rendered for the first time as we dynamically buildcode to handle all global var per shader

Mask system instance

objectRenderer: ObjectRendererSystem

_render system instance

Options passed to the constructor.

prepare: Prepare
projection: ProjectionSystem

Projection system instance

renderTexture: RenderTextureSystem

RenderTexture system instance

runners: {
    [key: string]: Runner;
}

a collection of runners defined by the user

Type declaration

scissor: ScissorSystem

Scissor system instance

shader: ShaderSystem

Shader system instance

startup: StartupSystem

startup system instance

State system instance

stencil: StencilSystem

Stencil system instance

texture: TextureSystem

Texture system instance

textureGC: TextureGCSystem

Texture garbage collector system instance

textureGenerator: GenerateTextureSystem

textureGenerator system instance

transformFeedback: TransformFeedbackSystem

TransformFeedback system instance

type: WEBGL = RENDERER_TYPE.WEBGL

The type of the renderer. will be PIXI.RENDERER_TYPE.CANVAS

Member

See

PIXI.RENDERER_TYPE

prefixed: string | boolean

Accessors

  • get autoDensity(): boolean
  • Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.

    Returns boolean

  • get backgroundAlpha(): number
  • The background color alpha. Setting this to 0 will make the canvas transparent.

    Returns number

    Member

    Deprecated

    since 7.0.0

  • set backgroundAlpha(value): void
  • Parameters

    • value: number

    Returns void

    Deprecated

    since 7.0.0

  • get backgroundColor(): ColorSource
  • The background color to fill if not transparent

    Returns ColorSource

    Member

    Deprecated

    since 7.0.0

  • set backgroundColor(value): void
  • Parameters

    Returns void

  • get clearBeforeRender(): boolean
  • This sets weather the screen is totally cleared between each frame withthe background color and alpha

    Returns boolean

    Deprecated

    since 7.0.0

  • get height(): number
  • Same as view.height, actual number of pixels in the canvas by vertical.

    Returns number

    Default

    600
    
  • get powerPreference(): WebGLPowerPreference
  • Returns WebGLPowerPreference

    Deprecated

    since 7.0.0

  • get preserveDrawingBuffer(): boolean
  • readonly drawing buffer preservation we can only know this if Pixi created the context

    Returns boolean

    Deprecated

    since 7.0.0

  • get rendererLogId(): string
  • When logging Pixi to the console, this is the name we will show

    Returns string

  • get renderingToScreen(): boolean
  • Flag if we are rendering to the screen vs renderTexture

    Returns boolean

  • get resolution(): number
  • The resolution / device pixel ratio of the renderer.

    Returns number

  • set resolution(value): void
  • The resolution / device pixel ratio of the renderer.

    Parameters

    • value: number

    Returns void

  • get screen(): Rectangle
  • Measurements of the screen. (0, 0, screenWidth, screenHeight).

    Its safe to use as filterArea or hitArea for the whole stage.

    Returns Rectangle

    Member

  • get useContextAlpha(): boolean | "notMultiplied"
  • Pass-thru setting for the canvas' context alpha property. This is typically not something you need to fiddle with. If you want transparency, use backgroundAlpha.

    Returns boolean | "notMultiplied"

    Deprecated

    since 7.0.0

    Member

  • get view(): ICanvas
  • The canvas element that everything is drawn to.

    Returns ICanvas

  • get width(): number
  • Same as view.width, actual number of pixels in the canvas by horizontal.

    Returns number

    Member

    Default

    800
    

Methods

  • Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

  • Create a bunch of runners based of a collection of ids

    Parameters

    • Rest ...runnerIds: string[]

      the runner ids to add

    Returns void

  • Add a new system to the renderer.

    Parameters

    • ClassRef: ISystemConstructor<Renderer>

      Class reference

    • name: string

      Property name for system, if not specified will use a static name property on the class itself. This name will be assigned as s property on the Renderer so make sure it doesn't collide with properties on Renderer.

    Returns this

    Return instance of renderer

  • Clear the frame buffer.

    Returns void

  • Removes everything from the renderer (event listeners, spritebatch, etc...)

    Parameters

    Returns void

  • Calls each of the listeners registered for a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Rest ...args: any[]

    Returns boolean

  • A function that will run a runner and call the runners function but pass in different options to each system based on there name.

    E.g. If you have two systems added called systemA and systemB you could call do the following:

    system.emitWithCustomOptions(init, {
    systemA: {...optionsForA},
    systemB: {...optionsForB},
    });

    init would be called on system A passing optionsForA and on system B passing optionsForB.

    Parameters

    • runner: Runner<any, any[]>

      the runner to target

    • options: Record<string, unknown>

      key value options for each system

    Returns void

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

  • Useful function that returns a texture of the display object that can then be used to create sprites This can be quite useful if your displayObject is complicated and needs to be reused multiple times.

    Parameters

    Returns RenderTexture

    A texture of the graphics object.

  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Add a listener for a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

  • Add a one-time listener for a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns this

  • Remove the listeners of a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Renders the object to its WebGL view.

    Parameters

    Returns void

  • Resets the WebGL state so you can render things however you fancy!

    Returns this

    Returns itself.

  • Resizes the WebGL view to the specified width and height.

    Parameters

    • desiredScreenWidth: number

      The desired width of the screen.

    • desiredScreenHeight: number

      The desired height of the screen.

    Returns void

  • Set up a system with a collection of SystemClasses and runners. Systems are attached dynamically to this class when added.

    Parameters

    • config: ISystemConfig<Renderer>

      the config for the system manager

    Returns void

Generated using TypeDoc