Class: Renderer

graphics.Renderer

Renderer

Constructor

new Renderer()

Core class for rendering in the canvas

To Do:
  • must be a singleton ??
Example
var id = document.getElementById('canvas');
var renderer = new Renderer(id);
renderer.addScene(myScene);
// Inititalize the renderer just before executing the rendering loop
renderer.init();
// Run infinite loop
renderer.drawScene();

Methods

addScene(a_scene)

Add scene

Parameters:
Name Type Description
a_scene Scene

Add a scene which is the root of the scene graph.

addSensor(a_sensor)

Add sensor

Parameters:
Name Type Description
a_sensor Sensor

Add a sensor or an object interacting with the scene graph

drawScene()

Draw the scene. This function triggers the OpenGL rendering in an infinite loop.

getContext() → {number}

Get graphics context

Returns:
  • Reference of the OpenGL graphics context
Type
number

init()

Initialize the renderer.