[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 2010-09-09, at 4:22 PM, Chris Marrin wrote:


On Sep 9, 2010, at 12:32 PM, Gregg Tavares (wrk) wrote:

If I do this

<canvas width="2560" height="1600"></canvas>
canvas = document.getElementByTagName("canvas")[0];
gl = canvas.getContext("webgl");

Or this

<canvas></canvas>

canvas = document.getElementByTagName("canvas")[0];
gl = canvas.getContext("webgl");
canvas.width = 2560;
canvas.height = 1600;


And the GPU I'm on only supports 2048 maximum backbuffer size. What should happen?

1) getContext fails for case 1 above? for 2 you get lost context

2) You get a backbuffer of the maximum size. canvas.width and canvas.height change to match?

3) You get an exception

4) An out of range width setting is ignored it stays whatever it previously was.

5) ????

It seems like it would be best to fail. The problem is that if you fail to create the GL context, you'll have no way to query for the max size so you can know what size you can specify. You can always specify a 1x1 canvas, then create the context, then query and resize. But that seems a bit lame. Does GLES have a required minimum framebuffer size that authors can rely on, so they only need to deal with this if they want above that minimum?

The ES2 minimums required for 
MAX_TEXTURE_SIZE is 64, and for MAX_RENDERBUFFER_SIZE is 1.

For MAX_VIEWPORT_SIZE it says "The maximum viewport dimensions must be greater than or equal to the visible dimensions of the display being rendered to." However it doesn't state a minimum on the size that is, presumably because it could come from the window manager which is outside the domain of the GL spec.

So no, I don't think there is a required minimum framebuffer size that authors could rely on.

Hope this helps,
Daniel

---
                        Daniel Koch -+- daniel@transgaming.com
Senior Graphics Architect -+- TransGaming Inc.  -+- www.transgaming.com