diff --git a/src/lib/Renderer.ts b/src/lib/Renderer.ts index 13d9e58..1182bb9 100644 --- a/src/lib/Renderer.ts +++ b/src/lib/Renderer.ts @@ -4,6 +4,7 @@ import {UniformType} from "./Uniform.js"; import type Program from "./Program.js"; import type {RendererBuffer} from "./RendererBuffer.js"; import type {Texture} from "./Texture.js.js"; +import type {RendererInstance} from "./RendererInstance.js"; /** * @typedef {Object} ImageOptions @@ -25,6 +26,7 @@ export class Renderer { public width: number = 0; public height: number = 0; public program!: Program; + public main!: RendererInstance; gl: WebGLInstance; protected frame: number = 0; diff --git a/src/lib/RendererInstance.ts b/src/lib/RendererInstance.ts index dd722bc..0ed1adb 100644 --- a/src/lib/RendererInstance.ts +++ b/src/lib/RendererInstance.ts @@ -32,6 +32,7 @@ export class RendererInstance extends Renderer { this.options = {...ImageEffectRenderer.defaultOptions, ...options}; this.index = RendererInstance.index++; this.container = container; + this.main = this; if (this.options.useSharedContext) { this.canvas = document.createElement('canvas'); @@ -89,6 +90,7 @@ export class RendererInstance extends Renderer { } const newBuffer = new RendererBuffer(this.gl, options); newBuffer.program = this.gl.compileShader(shader); + newBuffer.main = this; return this.buffers[i] = newBuffer; }