Documentation / spryte / createSharedRenderer
Function: createSharedRenderer()
createSharedRenderer(
gl,options?):SharedRenderer
Defined in: shared.ts:34
A Draw for a WebGL2 context another engine owns (Phaser, PixiJS, your own code), to draw with spryte inside the host's frame and in its draw order, on one GPU context with no overlay canvas. Create it inside the slot the host gives you for foreign drawing, since creating it changes GL state. Each frame, in that slot: shared.target(...) if the host's destination changed, draw.begin(null, width, height, scale) (null draws over the host's frame), draw, draw.end().
What spryte sets at begin() and leaves to the host afterwards is listed in docs/architecture.md. The host's scissor and stencil are respected: a camera viewport or mask applies to spryte's drawing too, and spryte's own clips intersect the host's scissor. Context loss is the host's: it must preventDefault on webglcontextlost for the browser to restore the context, and spryte rebuilds its GPU objects at the first begin() after.
Parameters
gl
WebGL2RenderingContext