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

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



On 2012/11/11 1:36, Gregg Tavares (社用) wrote:
This doesn't work for WebGL

   var context = new WebGLRenderingContext();
   canvas1.setContext(context)   

It's missing the creation attributes for the canvas (alpha? depth? stencil? anti-alias? preserved? premultiplied?)

Only alpha and premultiplied are truly canvas attributes. Alpha because it potentially affects the storage for the canvas pixels, although more than likely both RGB & RGBA canvases use 32 bpp, and premultiplied because it affects how those pixels are interpreted, as does alpha. Except for preserved, the rest of the attributes involve additional memory blocks that could easily be reused for drawing to a different canvas. Whether you need preserved depends on your drawing algorithms so it should rightly be considered a context attribute.

We could probably argue until the cows come home about whether to make depth, stencil and anti-alias canvas or context attributes. I suggest the best approach is to consider use cases and how well assignment as either fits those use cases.

Regards

    -Mark

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

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.