Class: PIXI.WebGLRenderer
Constructor
new WebGLRenderer(game)
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 | Description |
---|---|---|
game | PhaserGame | A reference to the Phaser Game instance |
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 8)
Public Properties
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 53)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 167)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 69)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 153)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 20)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 89)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 146)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 124)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 61)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 118)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 174)
- Default Value
- 1
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 36)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 132)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 139)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 160)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 45)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 30)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 97)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 81)
autoResize : boolean
Whether the render view should be resized automatically
blendModeManager : PIXI.WebGLBlendModeManager
Manages the blendModes
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.
filterManager : PIXI.WebGLFilterManager
Manages the filters
game :PhaserGame
height : number
The height of the canvas view
maskManager : PIXI.WebGLMaskManager
Manages the masks using the stencil buffer
offset :Point
preserveDrawingBuffer : boolean
The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering.
projection :Point
renderSession : Object
resolution : number
The resolution of the renderer
shaderManager : PIXI.WebGLShaderManager
Deals with managing the shader programs and their attribs
spriteBatch : PIXI.WebGLSpriteBatch
Manages the rendering of sprites
stencilManager : PIXI.WebGLStencilManager
Manages the stencil buffer
transparent : boolean
Whether the render view is transparent
type : number
view :HTMLCanvasElement
The canvas element that everything is drawn to
width : number
The width of the canvas view
Public Methods
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 398)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 204)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 430)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 243)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 278)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 315)
- Source code: pixi/renderers/webgl/WebGLRenderer.js (Line 341)
destroy()
Removes everything from the renderer (event listeners, spritebatch, etc...)
initContext()
mapBlendModes()
Maps Pixi blend modes to WebGL blend modes.
render(stage)
Renders the stage to its webGL view
Parameters
Name | Type | Description |
---|---|---|
stage | Stage | the Stage element to be rendered |
renderDisplayObject(displayObject, projection, buffer)
Renders a Display Object.
Parameters
Name | Type | Description |
---|---|---|
displayObject | DisplayObject | The DisplayObject to render |
projection | Point | The projection |
buffer | Array | a standard WebGL buffer |
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 |
updateTexture(texture) → {Boolean}
Updates and Creates a WebGL texture for the renderers context.
Parameters
Name | Type | Description |
---|---|---|
texture | PIXI.Texture | the texture to update |
Returns
True if the texture was successfully bound, otherwise false.
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/PIXI.WebGLRenderer.html