Renders to the Canvas using a function. All graphics functions inside the callback will affect the Canvas contents instead of directly rendering to the headset. This can be used in lovr.update.

Canvas:renderTo(callback, ...)


callbackfunctionThe function to use to render to the Canvas.
...*Additional arguments to pass to the callback.




Make sure you clear the contents of the canvas before rendering by using Otherwise there might be data in the canvas left over from a previous frame.

Also note that the transform stack is not modified by this function. If you plan on modifying the transform stack inside your callback it may be a good idea to use and so you can revert to the previous transform afterwards.

See also