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

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



If we're discussing naming maybe it should be called DrawingBuffer since we already have 'preserveDrawingBuffer: true/false as one of the creation parameers?


On Thu, Oct 18, 2012 at 10:31 AM, Florian Bösch <pyalot@gmail.com> wrote:
On Thu, Oct 18, 2012 at 6:40 PM, Chris Marrin <cmarrin@apple.com> wrote:
ctx = WebGLRenderingContext.createContext();
canvasFB = ctx.createCanvas(canvas, attrs);
ctx.bindCanvasFrameBuffer(canvasFB);

Would be the same as:

ctx = canvas.getContext("webgl", attrs);
canvasFB = ctx.currentCanvasFrameBuffer();

I like this idea, but I find the naming/semantic a bit confusing. Here's some suggestions:

Framebuffer is confusing since it's also used by one context to imply something different. I'd substitute by "FrontBuffer".

Creating a context without a frontbuffer:
var ctx = new WebGLRenderingContext();

Creating a frontbuffer:
var frontbuffer = ctx.createFrontBuffer(canvas);

Setting the frontbuffer to be rendered to:
ctx.frontbuffer = frontbuffer

Getting the frontbuffer currently used:
ctx.frontbuffer

Getting the canvas a frontbuffer is attached to:
frontbuffer.canvas

Getting the frontbuffer a canvas is attached to:
canvas.frontbuffer