pixi.renderers.webgl.WebGLRenderer

type
class
implements
pixi.renderers.IRenderer
metadata
:native
"PIXI.WebGLRenderer"

Constructor

new(width : Float, height : Float, ?options : pixi.utils.RenderingOptions)
parameters
[width=0] {Float} the width of the canvas view
[height=0] {Float} the height of the canvas view
[options] {Object} The optional renderer parameters
[options.view] {HTMLCanvasElement} the canvas to use as a view, optional
[options.transparent=false] {Bool} If the render view is transparent, default false
[options.antialias=false] {Bool} sets antialias (only applicable in chrome at the moment)
[options.preserveDrawingBuffer=false] {Bool} enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context
[options.resolution=1] {Float} the resolution of the renderer retina would be 2
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 :)

Instance Variables

Manages the blendModes

clearBeforeRender : Bool

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.

contextLostBound : pixi.utils.Event -> Void

contextRestoredBound : pixi.utils.Event -> Void

Manages the filters

height : Float

The height of the canvas view
Manages the masks using the stencil buffer

offset : pixi.geom.Point

preserveDrawingBuffer : Bool

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

projection : pixi.geom.Point

renderSession : Dynamic

TODO remove

resolution : Float

The resolution of the renderer
Deals with managing the shader programs and their attribs
Manages the rendering of sprites
Manages the stencil buffer

transparent : Bool

Whether the render view is transparent

type : Int

The canvas element that everything is drawn to

width : Float

The width of the canvas view

Instance Methods

destroy() : Void

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

initContext() : Void

mapBlendModes() : Void

Maps Pixi blend modes to WebGL blend modes.

render(stage : pixi.display.Stage) : Void

parameters
stage {Stage} the Stage element to be rendered
Renders the stage to its webGL view

renderDisplayObject(displayObject : pixi.display.DisplayObject, projection : pixi.geom.Point, buffer : Array<Dynamic>) : Void

parameters
displayObject {DisplayObject} The DisplayObject to render
projection {Point} The projection
buffer {Array} a standard WebGL buffer
Renders a Display Object.

resize(width : Float, height : Float) : Void

parameters
width {Float} the new width of the webGL view
height {Float} the new height of the webGL view
resizes the webGL view to the specified width and height

updateTexture(texture : pixi.textures.Texture) : pixi.textures.Texture

parameters
texture {Texture} the texture to update
Updates and Creates a WebGL texture for the renderers context.