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

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



Long thread...

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.

Tony

On Wed, Dec 12, 2012 at 8:00 AM, Florian Bösch <pyalot@gmail.com> wrote:
On Wed, Dec 12, 2012 at 4:45 PM, Vladimir Vukicevic <vladimir@mozilla.com> wrote:
does that getContext conceptually create a Drawingbuffer and call setDrawingbuffer on the canvas, as well as call bindDrawingbuffer on the gl context?
Yes
 
Is Drawingbuffer webgl-specific, or a general abstraction? (Bikeshed note: we need a better name than "Drawingbuffer" IMO...). However, we'd still need to determine the types of contexts that it can be used with if it's general.  Maybe something like:
We've iterated this already on this thread in October, Frontbuffer was worse, framebuffer is easily confused with framebuffer object, drawingbuffer is actually a pretty good description.
 
gl = new WebGLRenderingContext();
db1 = gl.createDrawingBuffer({ depth: false });
canvas.displayDrawingBuffer(db1);  // setDrawingBuffer on the canvas seems like a weird API name, as we're really choosing what buffer to display; what buffer is drawn to is selected by the context
How about canvas.setDisplayBuffer(db1) ?
 
twodee = Canvas2DRenderingContext();
db2 = twodee.createDrawingBuffer({ doubleBuffer: true });
canvas.displayDrawingBuffer(db2);  // is this legal; canvas originally displayed a webgl buffer?
It should be legal in my opinion to attach an entirely different drawing buffer to the same canvas. The context specificity goes with the drawing buffer. 
 
db1 = new Drawingbuffer("webgl", { depth: false });
db2 = new Drawingbuffer("2d", { doubleBuffer: true });
It's an interesting question, I might be wrong but people where arguing for a context independent way to create drawing buffers (somewhere back in october?).



--
Tony Parisi                             tparisi@gmail.com
CTO at Large                         415.902.8002
Skype                                     auradeluxe
Follow me on Twitter!             http://twitter.com/auradeluxe
Read my blog at                     http://www.tonyparisi.com/

Read my book! WebGL, Up and Running
http://shop.oreilly.com/product/0636920024729.do
http://www.amazon.com/dp/144932357X