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

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



What does the proxy object add?

One idea webgl has discussed is that you could transfer a context and it would get transfered by ownership, same as ArrayBuffer does now. The old context object in the passer would enter the "contextlost" state. This would let you just transfer the context directly. Mozilla has pointed out that 2D canvas now also needs contextlost support because of GPU acceleration so adding that to canvas 2D would let it use the same solution. No need for a proxy



On Sat, Nov 10, 2012 at 2:14 PM, Rik Cabanier <cabanier@gmail.com> wrote:
very cool!
That would be very useful.


On Fri, Nov 9, 2012 at 8:58 PM, Ian Hickson <ian@hixie.ch> wrote:
On Fri, 9 Nov 2012, Rik Cabanier wrote:
>
> Is this what you're trying to do?
>
> 1. have a web worker create a context
> 2. have the web work draw into that context
> 3. pass this context to the main thread
> 4. call canvas1.setContext
>
> If so, I think there needs to be something special for step 3. Otherwise
> you could still draw in the worker while it's displayed in the main
> thread.

I'm writing up a more concrete proposal for discussion, but basically, the
idea is that you would get a canvas proxy object, pass it to the worker,
have the worker create a 2D Context, bind the canvas proxy object and the
context, and then a method on the canvas proxy could be used to push the
graphics instructions sent to the 2D context to the screen.

I hope to have a more concrete proposal ASAP.

--
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'