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

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




On Nov 10, 2012, at 12:37 PM, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:


On 11/10/12 11:12 AM, Ian Hickson wrote:
In the current model, there's a one-to-one relationship, so the question
is moot.

In the current model there is a one-to-many relationship between a canvas and canvas contexts.  In particular, it's possible to grab both a 2d context and a webgl context for the same canvas.  This happens to change which backing store the canvas is using, though, so conceptually the backing store is tied to the context, not the canvas...

I thought we made such things illegal. At least I think we do not require support of such a relationship in WebGL. I'm unfortunately not finding the relevant parts of the spec, so maybe I'm mistaken. But I remember the issue coming up because someone wanted to render to a WebGL context and then render 2D on top of it. There are some implementations (maybe even most or all) which could not do such a thing very efficiently. The point was raised that if you wanted to do that you'd probably have to implement it with separate drawing buffers and then composite them on the back end. And if you're going to have to do that, why not just save a lot of headaches (in describing the interactions between the two) and forbid it. If you want 2D on top of 3D just create 2 canvases and put one on top of the other. Then the back end compositor will do the same job of combining them.

-----
~Chris Marrin
cmarrin@apple.com