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

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

On 2012/10/23 0:00, Vladimir Vukicevic wrote:
If we take the view that each canvas operates like a framebuffer, then the attribs will be used to configure the framebuffer for that canvas.  For example, you may want one canvas that has depth but no alpha, and another where you need alpha but don't care about depth.

So, for example:

var gl = canvas1.getContext("webgl", { depth: true, alpha: false });
var gl2 = canvas2.getContext("webgl", { attach: ctx, depth: false, alpha: true });
assert(gl === gl2);

ctx.getContextAttibutes() we can extend to be ctx.getContextAttributes(canvas), with default of null being the original canvas (i.e. canvas1).
There is a contradiction highlighted by the above where certain attributes are framebuffer (canvas) attributes yet we continue to set and get them as context attributes. Which attributes are you allowed to change when getting gl2 above without affecting canvas1?

The canvas is really a color attachment to an FBO. The only attribute that directly applies is alpha. Unfortunately context attributes and surface attributes were conflated by EGL (and its precursors). Because of this conflation, which is behind most of the issues Gregg raised, I prefer to not re-use bindFramebuffer but instead have a new command such as ctx.setDefaultFramebuffer or ctx.setCanvas.



注意:この電子メールには、株式会社エイチアイの機密情報が含まれている場合が有ります。正式なメール受信者では無い場合はメール複製、 再配信または情報の使用を固く禁じております。エラー、手違いでこのメールを受け取られましたら削除を行い配信者にご連絡をお願いいたし ます.

NOTE: This electronic mail message may contain confidential and privileged information from HI Corporation. If you are not the intended recipient, any disclosure, photocopying, distribution or use of the contents of the received information is prohibited. If you have received this e-mail in error, please notify the sender immediately and permanently delete this message and all related copies.