Options
All
  • Public
  • Public/Protected
  • All
Menu

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 WebGLBatchesm, 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
PIXI.BatchSystem This manages object renderers that defer rendering until a flush.
PIXI.ContextSystem This manages the WebGL context and extensions.
PIXI.FilterSystem This manages the filtering pipeline for post-processing effects.
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.MaskSystem This manages masking operations.
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.ScissorSystem This handles scissor masking, and is used internally by MaskSystem
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.StencilSystem This handles stencil masking, and is used internally by MaskSystem
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.

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

memberof

PIXI

Hierarchy

Index

Constructors

constructor

Properties

CONTEXT_UID

CONTEXT_UID: number

Protected _backgroundColor

_backgroundColor: number

_backgroundColorRgba

_backgroundColorRgba: number[]

Protected _backgroundColorString

_backgroundColorString: string

_lastObjectRendered

_lastObjectRendered: IRenderableObject

Readonly autoDensity

autoDensity: boolean

batch

Optional clearBeforeRender

clearBeforeRender: boolean

context

context: ContextSystem

filter

filter: FilterSystem

framebuffer

framebuffer: FramebufferSystem

geometry

geometry: GeometrySystem

gl

globalUniforms

globalUniforms: UniformGroup

mask

Readonly options

Readonly plugins

Readonly preserveDrawingBuffer

preserveDrawingBuffer: boolean

projection

projection: ProjectionSystem

renderTexture

renderTexture: RenderTextureSystem

renderingToScreen

renderingToScreen: boolean

resolution

resolution: number

runners

runners: {}

Type declaration

scissor

scissor: ScissorSystem

Readonly screen

screen: Rectangle

shader

shader: ShaderSystem

state

stencil

stencil: StencilSystem

texture

texture: TextureSystem

textureGC

textureGC: TextureGCSystem

Readonly type

Readonly useContextAlpha

useContextAlpha: boolean | "notMultiplied"

Readonly view

view: HTMLCanvasElement

Static __plugins

__plugins: IRendererPlugins

Collection of installed plugins. These are included by default in PIXI, but can be excluded by creating a custom build. Consult the README for more information about creating custom builds and excluding plugins.

name

plugins

readonly
property

{PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.

property

{PIXI.Extract} extract Extract image data from renderer.

property

{PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.

property

{PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects.

property

{PIXI.Prepare} prepare Pre-render display objects.

property

{PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects.

property

{PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects.

Static prefixed

prefixed: string | boolean

Accessors

backgroundAlpha

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

    member

    {number}

    Returns number

  • The background color alpha. Setting this to 0 will make the canvas transparent.

    Parameters

    • value: number

    Returns void

backgroundColor

  • get backgroundColor(): number
  • set backgroundColor(value: number): void
  • The background color to fill if not transparent

    member

    {number}

    Returns number

  • The background color to fill if not transparent

    Parameters

    • value: number

    Returns void

extract

  • get extract(): any
  • Please use plugins.extract instead.

    member

    {PIXI.Extract} extract

    deprecated

    since 6.0.0

    readonly

    Returns any

height

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

    member

    {number}

    readonly
    default

    600

    Returns number

width

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

    member

    {number}

    readonly
    default

    800

    Returns number

Methods

addListener

addSystem

  • Add a new system to the renderer.

    Type parameters

    Parameters

    • ClassRef: new (renderer: Renderer) => T

      Class reference

    • name: string

    Returns Renderer

    Return instance of renderer

clear

  • clear(): void
  • Clear the frame buffer

    Returns void

destroy

  • destroy(removeView?: boolean): void
  • Removes everything from the renderer (event listeners, spritebatch, etc...)

    Parameters

    • Optional removeView: boolean

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

generateTexture

  • 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

    • displayObject: IRenderableObject

      The displayObject the object will be generated from.

    • Optional scaleMode: SCALE_MODES

      The scale mode of the texture.

    • Optional resolution: number

      The resolution / device pixel ratio of the texture being generated.

    • Optional region: Rectangle

    Returns RenderTexture

    A texture of the graphics object.

Protected initPlugins

  • Initialize the plugins.

    Parameters

    Returns void

listenerCount

  • listenerCount(event: string | symbol): number
  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

listeners

  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

    Returns ListenerFn[]

off

  • Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Renderer

on

  • Add a listener for a given event.

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns Renderer

once

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

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns Renderer

removeAllListeners

  • removeAllListeners(event?: string | symbol): Renderer
  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns Renderer

removeListener

  • removeListener(event: string | symbol, fn?: ListenerFn, context?: any, once?: boolean): Renderer
  • Remove the listeners of a given event.

    Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Renderer

render

  • Renders the object to its WebGL view.

    Parameters

    Returns void

  • Please use the option render arguments instead.

    deprecated

    Since 6.0.0

    Parameters

    Returns void

reset

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

    Returns Renderer

    Returns itself.

resize

  • resize(screenWidth: number, screenHeight: number): void
  • Resizes the WebGL view to the specified width and height.

    Parameters

    • screenWidth: number

      The new width of the screen.

    • screenHeight: number

      The new height of the screen.

    Returns void

Static Private create

  • Create renderer if WebGL is available. Overrideable by the @pixi/canvas-renderer package to allow fallback. throws error if WebGL is not available.

    static

    Parameters

    Returns AbstractRenderer

Static registerPlugin

  • Adds a plugin to the renderer.

    method

    Parameters

    Returns void

Generated using TypeDoc