Enables customized rendering strategies
An external engine enables a customized rendering strategy.
For example, in demo-bouncing-balls.html
, an external engine is created
delegating the rendering process to three functions declared in the page: allocate
,
draw
, and deallocate
. These callback functions receive two parameters
a renderer reference and a scene reference
With help of vxlProgram.createFromDom
a customized shader/rendering process
can be achieved in voxelent
Once the engine and the program are set (vxlRenderer.setEngine
, vxlRenderer.setProgram
)
the renderer is ready. Then, view.start()
will initiate rendering.
var view = vxl.api.setup('view-1'); var engine = new vxlExternalEngine(view.renderer, allocate, draw, deallocate); var program = vxlProgram.createFromDOM('balls','shader-vs','shader-fs'); view.renderer.setEngine(engine); view.renderer.setProgram(program); view.start();
Check out the source code of demo-bouncing-balls.html on GitHub to see how vxlExternalEngine can be used
Parameters:
Function |
allocate
|
Reference to the callback function that will be in charge of allocating resources for rendering. This function must receive two parameters: a renderer and a scene. pointing to the scene to be rendered. |
Function |
render
|
Reference to the callback function that will render the scene. This function must receive two parameters: a renderer and a scene. |
Function |
deallocate
|
Reference to the callback function that will clean up any resources at the end of the rendering cycle. This function must receive two parameters: a renderer and a scene. |
deallocate
|
|