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

Re: [Public WebGL] Some WebGL draft feedback




On Dec 23, 2009, at 2:04 PM, Tim Johansson wrote:

On 12/23/09 11:53 AM, Gregg Tavares wrote:
Having more than one context has apparently been around since 2006

http://my.opera.com/WebApplications/blog/show.dml/200788

And the HTML5 spec certainly doesn't discourage multiple contexts by design.

It seems like that's the design they intended as it's by far the most useful.

The opera-2dgame context was something I added because it was required to move some demos we had in a technology similar to <canvas> to <canvas>. It does not say much about the intent of the HTML5 spec.

Almost all of the functionality of that context has since been added to the main 2d context.

That suggests a few different paths

1) Support multiple contexts including webgl.

I certainly understand the issues here though it wouldn't be all that hard to implement it in such a way that there is no performance penalty if not used. WebGL already has to support canvas.toDataURL so the code to support that could easily be called if a draw function in a different context is used and visa-versa.

The only reliable way I see of doing that is to have some kind of present function which copies the pixels to the <canvas>. Doing that would make writing webgl content more complicated and potentially make it much harder to write an implementation which performs well.

2) Don't support multiple contexts.

That seems like bad choice given that there is already precedent and it's extremely useful. If canvas is by design, a bucket of pixels then it certainly makes sense that it would be possible to effect those pixels in multiple ways and as more ways come up use them all together.

It might be OK for us to drop opera-2dgame if it is not widely used, have to check that though. Most of the functionality from opera-2dgame is in 2d anyway.
It would also be possible to distinguish between "main" contexts and "extension" contexts and just not allow multiple "main" contexts. I would say opera-2dgame is an extension to 2d.

Thanks, Tim. Ok, so it sounds like opera-2dgame is really just an extension to the 2d context. So that makes it reasonable to use both contexts to render to the canvas at the same time. The same can't be said for 2D vs WebGL. The API's are radically different and mixing API calls on many platforms can be difficult or impossible. More on that in my response to Gregg's post.


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




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