Navigation
These archived docs are for Phaser 2.3.0 Phaser 3 docs can be found on newdocs.phaser.io.
Phaser CE docs can be found on the Phaser CE Documentation site.

Constructor

PIXI. WebGLRenderer

new WebGLRenderer(width, height, options)

The WebGLRenderer draws the stage and all its content onto a webGL enabled canvas. This renderer should be used for browsers that support webGL. This Render works by automatically managing webGLBatchs. 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 :)

Parameters
Name Type Argument Default Description
width Number <optional>
0

the width of the canvas view

height Number <optional>
0

the height of the canvas view

options Object <optional>

The optional renderer parameters

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 8)

Public Properties

autoResize : boolean

Whether the render view should be resized automatically

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 70)

blendModeManager : PIXI.WebGLBlendModeManager

Manages the blendModes

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 203)

clearBeforeRender : boolean

This sets if the WebGLRenderer will clear the context texture or not before the new render pass. If true: If the Stage is NOT transparent, Pixi will clear to alpha (0, 0, 0, 0). If the Stage is transparent, Pixi will clear to the target Stage's background color. Disable this by setting this to false. For example: if your game has a canvas filling background image, you often don't need this set.

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 86)

contextLostBound : Function

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 126)

contextRestoredBound : Function

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 132)

filterManager : PIXI.WebGLFilterManager

Manages the filters

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 189)

height : number

The height of the canvas view

Default Value
  • 600
Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 107)

maskManager : PIXI.WebGLMaskManager

Manages the masks using the stencil buffer

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 182)

offset :Point

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 160)

preserveDrawingBuffer : boolean

The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering.

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 78)

projection :Point

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 154)

renderSession : Object

TODO remove

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 210)

resolution : number

The resolution of the renderer

Default Value
  • 1
Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 51)

shaderManager : PIXI.WebGLShaderManager

Deals with managing the shader programs and their attribs

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 168)

spriteBatch : PIXI.WebGLSpriteBatch

Manages the rendering of sprites

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 175)

stencilManager : PIXI.WebGLStencilManager

Manages the stencil buffer

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 196)

transparent : boolean

Whether the render view is transparent

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 62)

type : number

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 45)

view :HTMLCanvasElement

The canvas element that everything is drawn to

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 116)

width : number

The width of the canvas view

Default Value
  • 800
Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 98)

Public Methods

destroy()

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

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 467)

initContext()

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 237)

mapBlendModes()

Maps Pixi blend modes to WebGL blend modes.

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 501)

render(stage)

Renders the stage to its webGL view

Parameters
Name Type Description
stage PIXI.Stage

the Stage element to be rendered

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 275)

renderDisplayObject(displayObject, projection, buffer)

Renders a Display Object.

Parameters
Name Type Description
displayObject PIXI.DisplayObject

The DisplayObject to render

projection Point

The projection

buffer Array

a standard WebGL buffer

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 322)

resize(width, height)

Resizes the webGL view to the specified width and height.

Parameters
Name Type Description
width Number

the new width of the webGL view

height Number

the new height of the webGL view

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 359)

updateTexture(texture)

Updates and Creates a WebGL texture for the renderers context.

Parameters
Name Type Description
texture PIXI.Texture

the texture to update

Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 385)