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

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



On Oct 17, 2012, at 18:04, Gregg Tavares (社用) wrote:

> I'd like to pursue this idea further that Florian brought up which is that, for drawing to multiple canvases, rather than share resources across contexts it would be much nicer to just be able to use the same context with multiple canvases. Something like
> 
>     ctx1 = canvas1.getContext("webgl");
>     ctx1.clearColor(0,1,0,1);
>     ctx1.clear(gl.COLOR_BUFFER_BIT);
>     canvas2.setContext(ctx1);
>     ctx1.clear(gl.COLOR_BUFFER_BIT);
> 
> Clear's both canvas1 and canvas2 to green
> 
> Issues: Under the current WebGL the only way to setup a canvas is by calling getContext(..., contextCreationParameters). Whether the canvas is RGB or RGBA, has depth or stencil, is premultiplied or not, has it's backbuffer preserved or not, etc..

How about getContext("webgl", { attach: ctx1, other params... }); ? This way there never needs to exist a second context, and the canvas DOM interface doesn't need to be extended.

-- 
Kevin Reid                                  <http://switchb.org/kpreid/>


-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------