Constructs a new WebglRenderer
Parameters
| Name |
Type |
Attributes |
Default |
Description |
params |
object
|
<optional>
|
{}
|
context type
Properties
| Name |
Type |
Attributes |
Default |
Description |
type |
string
|
<optional>
|
webgl
|
context type |
canvas |
object
|
<optional>
|
null
|
canvas to attach the renderer |
width |
number
|
<optional>
|
window.innerWidth
|
width of the renderer |
height |
number
|
<optional>
|
window.innerHeight
|
height of the renderer |
contextOptions |
object
|
<optional>
|
{}
|
options to pass to the webgl context |
fallback |
function
|
<optional>
|
null
|
function called when webgl is not possible |
|
Methods
append(containeropt)
Append the renderer into an htmlElement
Parameters
| Name |
Type |
Attributes |
Default |
Description |
container |
object
|
<optional>
|
document.body
|
html element to add the canvas |
Add all the attributes of a mesh
Parameters
| Name |
Type |
Description |
mesh |
object
|
instance of a Mesh |
Bind all the buffer of a mesh
Parameters
| Name |
Type |
Description |
mesh |
object
|
instance of a Mesh |
Clear the color buffer & depth buffer
Set clearColor of the renderer
Parameters
| Name |
Type |
Description |
r |
number
|
red channel |
v |
number
|
green channel |
b |
number
|
blue channel |
a |
number
|
alpha channel |
render(mesh, camera)
Render to the canvas
Parameters
| Name |
Type |
Description |
mesh |
object
|
array
|
instance of a Mesh or array of Mesh |
camera |
object
|
instance of a Camera |
Set default uniforms to a mesh
Set all the uniforms of a mesh
Unbind all the buffer of a mesh
Parameters
| Name |
Type |
Description |
mesh |
object
|
instance of a Mesh |
Set the current program
Parameters
| Name |
Type |
Description |
program |
object
|
instance of a Shader |