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

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

On Sat, 17 Nov 2012, Gregg Tavares (社~T) wrote:
> Why would I want to do this? Because making paths is time consuming. 
> Assume my path requires 1000 lines. Why would I want to have to repeat 
> that N times?

This is a solved problem with the last batch of API additions:

   var path = new Path();
   for (var i = 0; i < 1000; ++i) {

However, when do you ever just draw a single path to three bitmaps, 
though? In all the cases I've ever used canvas, there's been multiple 
paths, changes to the line width, changes to the fill and strokes styles, 
text, transforms, etc. Are you saying you'd want to iterate through the 
canvases between each drawing operation just so you could reuse those 
styles without having to set them on two different contexts or run the 
same code for two canvases? That seems weird.

> This is especially important in WebGL where you're trying to draw a top, 
> front, side and perspective view.

Sure. See my e-mail to the WHATWG list -- the spec is intentionally 
written so that this can be done for WebGL.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'