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

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

On Thu, Oct 18, 2012 at 6:40 PM, Chris Marrin <cmarrin@apple.com> wrote:
ctx = WebGLRenderingContext.createContext();
canvasFB = ctx.createCanvas(canvas, attrs);

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:

Getting the canvas a frontbuffer is attached to:

Getting the frontbuffer a canvas is attached to: