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

Re: [Public WebGL] WebGL context resize / canvas redraw



On Thu, Feb 25, 2010 at 6:04 AM, Carl van Heezik <carl@microcan.nl> wrote:
> Chris,
> context resize
> I noticed some differences in the WebGL implementations in Webkit and
> Minefield.
> When you resize the canvas the following instructions are enough to resize
> the
> rendering context in Webkit.
>     canvas.width   = canvas.clientWidth;
>     canvas.height  = canvas.clientHeight;
>
> I think in Minefield you lose the shaders and other buffers because it only
> works
> when I recreate the shader program and buffers. What behavior is supposed to
> happen when you change the canvas size?

This is a bug in Minefield. Resizing the canvas should not destroy the
context, only reallocate the back buffer for the canvas.

> canvas redraw
> What action triggers the compositing of the canvas on the screen? In Webkit
> I see
> the following problem.
> I have an WebGL canvas that is rendered once in the body.onload function and
> also when you resize the browser window.
> The first time the render is OK but when I push the reload button of the
> browser
> several times, sometimes the render appears and sometimes it does not.
> When you resize the window the render always appears.
>   canvas.render = function()
>   {
>     var gl = this.gl;
>     var scene = this.scene;
>
>
>
>     // Set the viewport
>     gl.viewport(0, 0, this.width, this.height);
>     gl.clearColor(0, 0, 0, 0);
>     // Clear the canvas
>     gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
>     scene.render(gl);
>     gl.flush();
>     gl.finish();
>   }
> I found the following workaround. If I add the following line at the end of
> the
> body.onload instead of calling the above render function.
>   window.setTimeout(window.onresize, 10);
> Adding the following line doesn't work please explain.
>   window.onresize();

This sounds like a bug. Can you please provide a reduced test case?
You can file it directly on http://bugs.webkit.org under component
"WebGL".

-Ken

-----------------------------------------------------------
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: