Compiles a new renderer instance. There can multiple renderers on a single page.
Asynchronous behaviour is required for parallel shader compiling.
Trying to draw before the returned promise resolves, results in no action taken.
Settings can be set before promise resolution and they will be applied later.
The descriptors of every to-be-drawn objects are required before creating the renderer,
allowing the compiler to only create the shaders that will actually be used.
Compiles a new renderer instance. There can multiple renderers on a single page.
The descriptors of every to-be-drawn objects are required before creating the renderer, allowing the compiler to only create the shaders that will actually be used.
Example usage:
import { compile, Circle, CircleLight } from 'sdf-2d'; const canvas = document.querySelector('canvas'); const renderer = await compile(canvas, [Circle.descriptor, CircleLight.descriptor]);