# 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

A massive object filled with utility functions and properties to render Two.js objects to a <canvas /> through the WebGL API.

# domElement

The <canvas /> associated with the Two.js scene.

# scene

The root group of the scenegraph.

# overdraw

Determines whether the canvas clears the background each draw call.

# ctx

Associated two dimensional context to render on the <canvas />.

# programs

Associated WebGL programs to render all elements from the scenegraph.

# setSize


  • 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.

# render

Render the current scene to the <canvas />.