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

Re: [Public WebGL] Some WebGL draft feedback

Here's another way of looking at it.

What's the point of the <canvas> tag?

It *seems* like the point is to have a bucket of pixels that multiple contexts can write into.

I know some people disagree with that idea so let's pursue the single context point of view.

The canvas tag only defines 2 methods. getContext and toDataURL. So, if canvas is not allowed to have more than one context at a time what is really the point of the canvas tag? With the restriction of only 1 context at a time it might as well be the <object> tag with toDataURL added. You could just as easily make getContext("quicktime"), getContext("flash"), getContext("activex-xyz") and not break the canvas model if it enforces a single context restriction. Or, conversly, if <object> added toDataURL then creating an <object classid="" would have solved the same thing a single context canvas tag solves. In that light, there would be no point in having a canvas tag at all except to standardize on a 2d api and if that was the point then it might has well been <canvas2d> and no getContext function.

It seems like enforcing a single context robs the canvas tag of any meaning which to me suggests that either webgl needs to support working with multiple contexts OR it needs to have its own tag. Either way it seems better than removing all meaning from the canvas tag.

Advantages to staying with the canvas tag assuming multiple contexts

*) emotional momentum.
*) adds to the number of APIs that can be used to manipulate pixels in a canvas.

Advantages to switching to separate <webgl> tag

*) fixes the getContext problem of calling getContext twice with different initialization parameters.
*) fixes the issue that getContext is not supposed to be an initialization function so GL resources can be created on tag creation instead of getContext call.
*) removes issues with content already in the canvas from a previous context before getContext("webgl") is called.
*) lets khronos add whatever features they deem useful for webgl to the tag.
  *) buffering options (whether or not to double buffer for example)
  *) back buffer formats other than RGBA8
  *) compositing options.