Class vxlRenderer

Constructor

vxlRenderer(vw)
One of the main classes of Voxelent's NucleoA renderer object encapsulates most of the low level calls to WebGL.It is here where Nucleo obtains a reference to the WebGL context.It is also here here (and in the Actor class) where all the attributes and uniforms are passedto the rendering program.
Author: Diego Cantor.

Parameters:

vw

Methods

.clear()
Clears the WebGL scene
.clearColor(r, g, b)
Sets the color used to clear the rendering context

Parameters:

Type Name Description
Number|Array|vec3 r

it can be the red component, a 3-dimensional Array or a vec3 (glMatrix)

Number g

if r is a number, then this parameter corresponds to the green component

Number b

if r is a number, then this parameter corresponds to the blue component

See:

vxlView#setBackgroundColor
.clearDepth(d)
Sets the clear depth for the rendering context

Parameters:

Type Name Description
Number d

the new clear depth

.disableOffscreen()
Disables offscreen rendering
.doAfterRendering(func)

Parameters:

Type Name Description
func

.doBeforeRendering(func)

Parameters:

Type Name Description
func

.enableOffscreen()
Sets the render target for this renderer
.isOffscreenEnabled()
Returns true if the offscreen rendering is enabled. False otherwise.
.readOffscreenPixel(x, y)

Parameters:

Type Name Description
x

y

.reallocate()
Reallocates the actors marked as dirty, without requiring rerendering. This mechanism allowsto update the GL buffers for dirty actors.
.releaseProgram()
When the current program is being enforced by the renderer (see setProgram), anysubsequent call to setProgram will be unsuccessful. So for instance, actorswho want to use a different program to be rendered would not be able to do so.This method releases the current program from being enforced
.render()
Renders the scene using the current engine
.setEngine(p_engine)
Sets the current rendering engine.

The parameter can be a class definition or an instance of the engine

Parameters:

Type Name Description
vxlEngine p_engine

The engine to be used (function reference or instance)

.setMode(mode)
Sets the rendering mode. Options are in vxl.def.renderer.modeThis method updates the rendering mode and tries to restart the rendering process

Parameters:

Type Name Description
String mode

the mode to set

See:

vxl.def.render.mode
.setProgram(p_program, p_force_it)
Sets the current rendering program

The parameter can be a class definition or an instance of the program

Parameters:

Type Name Description
vxlProgram p_program

the program to be used (function reference or instance)

p_force_it

.setRenderRate()
Sets the rendering rate in ms

Parameters:

Type Name Description
Number /test-baking.htmlrate

the new rendering rate in milliseconds

.start()
Starts the renderer
.stop()
Stops the renderer