WebGLRenderer Class
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 webGLBatch's. So no need for Sprite Batch's or Sprite Cloud's Dont forget to add the view to your DOM or you will not see anything :)
Constructor
WebGLRenderer
-
[width=0]
-
[height=0]
-
[options]
Parameters:
-
[width=0]
Number optionalthe width of the canvas view
-
[height=0]
Number optionalthe height of the canvas view
-
[options]
Object optionalThe optional renderer parameters
-
[view]
HTMLCanvasElement optionalthe canvas to use as a view, optional
-
[transparent=false]
Boolean optionalIf the render view is transparent, default false
-
[antialias=false]
Boolean optionalsets antialias (only applicable in chrome at the moment)
-
[preserveDrawingBuffer=false]
Boolean optionalenables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context
-
[resolution=1]
Number optionalthe resolution of the renderer retina would be 2
-
Item Index
Methods
Properties
Methods
destroy
()
Removes everything from the renderer (event listeners, spritebatch, etc...)
render
-
stage
Renders the stage to its webGL view
Parameters:
-
stage
Stagethe Stage element to be rendered
renderDIsplayObject
-
displayObject
-
projection
-
buffer
Renders a display Object
Parameters:
-
displayObject
DisplayObjectThe DisplayObject to render
-
projection
PointThe projection
-
buffer
Arraya standard WebGL buffer
resize
-
width
-
height
resizes the webGL view to the specified width and height
Parameters:
-
width
Numberthe new width of the webGL view
-
height
Numberthe new height of the webGL view
updateTexture
-
texture
Updates and Creates a WebGL texture for the renderers context
Parameters:
-
texture
Texturethe texture to render
Properties
height
Number
The height of the canvas view
Default: 600
preserveDrawingBuffer
Boolean
The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering.
resolution
Number
The resolution of the renderer
Default: 1
transparent
Boolean
Whether the render view is transparent
view
HTMLCanvasElement
The canvas element that everything is drawn to
width
Number
The width of the canvas view
Default: 800