Two.WebGLRenderer
Extends: Two.Events
This class is used by Two when constructing with type of Two.Types.webgl. It takes Two.js' scenegraph and renders it to a <canvas /> through the WebGL api.
Constructor
| Argument | Description |
|---|---|
| parameters | This object is inherited when constructing a new instance of Two. |
| parameters.domElement | The <canvas /> to draw to. If none given a new one will be constructed. |
| parameters.offscreenElement | The offscreen two dimensional <canvas /> to render each element on WebGL texture updates. |
| parameters.antialias | Determines whether the canvas should clear render with antialias on. |
Utils
Two.WebGLRenderer.Utils
A massive object filled with utility functions and properties to render Two.js objects to a <canvas /> through the WebGL API.
overdraw
Two.WebGLRenderer.overdraw
Determines whether the canvas clears the background each draw call.
programs
Two.WebGLRenderer.programs
Associated WebGL programs to render all elements from the scenegraph.
setSize
Two.WebGLRenderer.setSize
Triggers:
event:resize
| Argument | Description |
|---|---|
| width | The new width of the renderer. |
| height | The new height of the renderer. |
| ratio | The new pixel ratio (pixel density) of the renderer. Defaults to calculate the pixel density of the user's screen. |
Change the size of the renderer.