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

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

On Thu, Dec 13, 2012 at 12:33 PM, Ian Hickson <ian@hixie.ch> wrote:
On Thu, 13 Dec 2012, Gregg Tavares (社ç~T¨) wrote:
> On Thu, Dec 13, 2012 at 1:13 AM, Tony Parisi <tparisi@gmail.com> wrote:
> >
> > I just wanted to throw my opinion in to mirror Ian's, that if we go
> > down this path, it should work for 2d canvas drawing contexts as well.
> > a) seems just as useful for 2D drawing and b) I would think that
> > consistency with the other canvas context behavior would be highly
> > desirable.
> I agree it would be highly desirable to have consistency. But if you go
> back in the thread it seems that Ian is not noticing that:
> (a) In WebGL we need "creation attributes"
> (b) The creation attributes need to be different for each "canvas" (either
> on each cavnas or on some other object that can be associated with a
> canvas). In other words i need to be able to create:
>    a canvas that is only RGB vs RGBA (for GL compatibility and speed)
>    a canvas that is anti-aliased vs not
>    a canvas that is double buffered vs single buffered (for speed)
>    a canvas that is composited assuming un-premultipled alpha vs
> premultipled alpha (for GL compatibility)
>    ...
> (c) we need to be able to use 1 context that can work across all of
> those types of canvases therefore those options can not be part of the
> context but must be part of some other object (canvas or drawingbuffer)
> The solution Ian has suggested so far does not cover those cases AFAICT.

Is this something that would make sense as arguments to setContext()?

It doesn't seem like the appropriate place since they are "creation" parameters and since for an animated app with multiple canvases you're going to be calling setContext once per canvas per frame.

On top of that, if understand your current setContext spec, setContext effectively destroys the content of the canvas when called and loses all state in the context. For WebGL and 1 context multiple canvases we need each canvas to keep its content with each call and we need the context to keep its state.


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