[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] using the same context with multiple canvases



I don't understand why we pursue this proposal: https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/OffscreenCanvas , which relies on the resize/copy-over semantic.
I believe that we should try to emulate framebuffer semantic as closely as possible. Ideally, we could just attach a canvas as color target to a framebuffer.

// setup the binding
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, canvas, 0)
gl.bindFramebuffer(null)

// drawing to
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
gl.drawArrays(...);