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

Re: [Public WebGL] Some WebGL draft feedback



On Jan 5, 2010, at 10:28 AM, Carl van Heezik wrote:

> Chris,
> 
> I vote for 1) glsl-fragment and glsl-vertex.
> 
> 
> I run into an issue with a resizable canvas. See: http://webgl.microcan.nl/ 
> 
> I have created a webpage with a canvas and a CSS file to make the body and the canvas width and height both 100%. 
> 
> The canvas resized but the resolution of the WebGL context stays the same. This means that you get the standard width and height 
> which seems to be 400 by 300 pixels scaled to the with and height of the canvas. The first workaround I tried was setting the width
> and height to the clientWidth and clientHeight before getContext().
> 
> canvas.width = canvas.clientWidth;
> canvas.height = canvas.clientHeight;
> 
> 
> After this you get an initial correct canvas but when you resize the browser window. You still get the same behavior. 
> I you start with a small window and push refresh, you get a correct canvas but if you resize the browser, the canvas is still scaled. 
> 
> Then I tried to solve this in an onResize handler, you have to redraw the scene anyway so this is not a problem. If you use
> the same trick you seem to lose the complete WebGL context. I tried some other options but none of them work in all browsers.
> 
> How do you create a canvas that resizes with the browser that works in all browsers that support WebGL. 
> 
> Another bug I noticed in Safari WebKit is that the resize handle disappears because I used a back opaque background as clearColor.
> You can still resize the browser but you can not see the drag handle.

Yeah, resizing is very confusing right now. WebKit sets the canvas size to its CSS (visible) size rather than to the size given in the canvas width and height attributes. So it behaves incorrectly wrt the spec. And I believe Firefox has other resizing issues. We should get this resolved ASAP. 

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




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