new WebGLRenderer( [width] [, height] [, options])
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 Properties
|
Extends
Members
-
autoResize :boolean
-
Whether the render view should be resized automatically
Type:
- boolean
- Inherited From:
- Source:
-
backgroundColor :number
-
The background color to fill if not transparent
Type:
- number
- Inherited From:
- Source:
-
blendModeManager :BlendModeManager
-
Manages the blendModes
Type:
-
blendModes :object.<string, mixed>
-
Tracks the blend modes useful for this renderer.
Type:
- object.<string, mixed>
- Inherited From:
- Overrides:
- Source:
-
clearBeforeRender :boolean
-
This sets if the CanvasRenderer will clear the canvas or not before the new render pass.
If the scene is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.
If the scene is transparent Pixi will use clearRect to clear the canvas every frame.
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.Type:
- boolean
- Inherited From:
- Source:
-
currentRenderer :ObjectRenderer
-
The currently active ObjectRenderer.
Type:
-
currentRenderTarget :RenderTarget
-
Holds the current render target
Type:
-
drawCount :number
-
Counter for the number of draws made each frame
Type:
- number
-
filterManager :FilterManager
-
Manages the filters.
Type:
-
height :number
-
The height of the canvas view
Type:
- number
- Inherited From:
- Default Value:
-
- 600
- Source:
-
maskManager :MaskManager
-
Manages the masks using the stencil buffer.
Type:
-
preserveDrawingBuffer :boolean
-
The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering.
Type:
- boolean
- Inherited From:
- Source:
-
resolution :number
-
The resolution of the renderer
Type:
- number
- Inherited From:
- Default Value:
-
- 1
- Source:
-
roundPixels :boolean
-
If true Pixi will Math.floor() x/y values when rendering, stopping pixel interpolation.
Handy for crisp pixel art and speed on legacy devices.Type:
- boolean
- Inherited From:
- Source:
-
shaderManager :ShaderManager
-
Deals with managing the shader programs and their attribs.
Type:
-
stencilManager :StencilManager
-
Manages the stencil buffer.
Type:
- StencilManager
-
transparent :boolean
-
Whether the render view is transparent
Type:
- boolean
- Inherited From:
- Source:
-
type :number
-
The type of this renderer as a standardised const
Type:
- number
- Overrides:
- Source:
-
view :HTMLCanvasElement
-
The canvas element that everything is drawn to
Type:
- HTMLCanvasElement
- Inherited From:
- Source:
-
width :number
-
The width of the canvas view
Type:
- number
- Inherited From:
- Default Value:
-
- 800
- Source:
Methods
-
destroy( [removeView])
-
Removes everything from the renderer (event listeners, spritebatch, etc...)
Parameters:
Name Type Argument Default Description removeView
boolean <optional>
false Removes the Canvas element from the DOM.
- Overrides:
- Source:
-
destroyTexture(texture)
-
Deletes the texture from WebGL
Parameters:
Name Type Description texture
BaseTexture | Texture the texture to destroy
-
render(object)
-
Renders the object to its webGL view
Parameters:
Name Type Description object
DisplayObject the object to be rendered
-
renderDisplayObject(displayObject, renderTarget)
-
Renders a Display Object.
Parameters:
Name Type Description displayObject
DisplayObject The DisplayObject to render
renderTarget
RenderTarget The render target to use to render this display object
-
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
- Overrides:
- Source:
-
setObjectRenderer(objectRenderer)
-
Changes the current renderer to the one given in parameter
Parameters:
Name Type Description objectRenderer
ObjectRenderer The object renderer to use.
-
setRenderTarget(renderTarget)
-
Changes the current render target to the one given in parameter
Parameters:
Name Type Description renderTarget
RenderTarget the new render target
-
updateTexture(texture)
-
Updates and/or Creates a WebGL texture for the renderer's context.
Parameters:
Name Type Description texture
BaseTexture | Texture the texture to update