Strange viewport on Chrome

I tried my WGT module on Chrome/Vista64 with strange results:

The canvas has correct size (full window), but at the top is a mirrored region and on the right there is a white region. The white region is indeed part of the canvas element because the region does change color when I change the background-color of the canvas using CSS. The canvas is cleared with gl.clearColor(0,0,0,1) so it should at least be black…

However, it has something to do with the window size. If the window is smaller it looks correctly.

I would say the viewport was set incorrectly, but on Firefox it works fine. Maybe this has something to do with the FBO I’m using? The FBO has only 0.3 times scene resolution, so I have to use gl.viewport very often to switch between resolutions. Also it is worth to mention that there is a Canvas2D layered transparently on top of the WebGL canvas. However, text is rendered correctly on the full window.

Any ideas? Thanks in advance.

( Demo available here, Sourcecode )

Since WGT is really complex I have created a smaller application and was able to reproduce the problem. I have tracked it down to this call:

gl.bindFramebuffer(gl.FRAMEBUFFER, null);

Using 0 instead of null has the same effect.

This sample does only read a textured fullscreen quad on a 1024x768 canvas. Besides the call to gl.bindFramebuffer above it does not use any FBOs, but the problem does also appear if I use a FBO before. Note the CSS-style on the canvas element, that’s where the red color comes from:

style="background-color:#FF0000;"

The sample does call draw() two seconds after the texture is available. You will see only a part of the image. Again after two seconds draw() is called again and the mirrored part at the top appears, similar to the screenshot in my previous post.

For me the canvas needs at least a size of 955x679 to get a 1px border at top and right. This might explain why nobody did run into this before. There are demos using FBOs, but besides my own I haven’t seen any samples at these resolutions.

I have a desktop resolution of 1280x1024 if that does matter. The sample does run fine on Firefox.

Can anyone confirm this problem?

Ok, there is no bug. You simply have to use the current nightly:
http://build.chromium.org/buildbot/snapshots/

I used the current Dev-Channel version, which is obviously something else…

I think the dev channel is a semi-official release which they update when they think it’s reasonably stable – so it generally lags the nightly build a bit. Anyway, glad you got to the bottom of this!