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

Re: [Public WebGL] Behavior of WebGL canvas when it can't make a backbuffer of the requested size?



On Sep 21, 2010, at 11:53 AM, Gregg Tavares (wrk) wrote:

> Re thinking about this, getting a lost context for trying to set the canvas too large seems bad because there is no easy recovery from lost context.
> 
> In other words, if we had some kind of error (say, an exception?) I could do this
> 
> try {
>   canvas.width = largeWidth;
>   canvas.height = largeHeight;
> } catch (e) {
>   canvas.width = smallWidthOrPreviousWidth;
>   canvas.height = smallHeightOrPreviousHeight;
> }
> 
> But as it is, if I get lost context I now have to reload all my resources. That doesn't seem desirable

Yeah, I think we really need a WebGL way of knowing the maximum dimensions of the canvas. Alternatively, we could always allow the setting of width and height to succeed, but internally use a smaller size. We could adjust the setViewport params to account for this size difference. So an author would never have to do anything. Their image might just be more pixelated on some hardware than on others. We'd still need provide actual size attrs from the WebGL context and maybe even max size, so the author has all the tools to make the right decisions. But doing it this way makes it so authors never have to worry about it.

-----
~Chris
cmarrin@apple.com




-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: