PDA

View Full Version : Strange viewport on Chrome



Coolcat
12-27-2009, 05:21 AM
I tried my WGT module (http://www.khronos.org/message_boards/viewtopic.php?f=46&t=2353) on Chrome/Vista64 with strange results:

http://img97.imageshack.us/img97/2860/wgt.th.jpg (http://img97.imageshack.us/i/wgt.jpg/)

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 (http://www-users.rwth-aachen.de/Martin.Weusten/develop/uc/wgt091226/), Sourcecode (http://www-users.rwth-aachen.de/Martin.Weusten/count.php?file=develop/uc/wgt-0.1-091226.zip) )

Coolcat
12-27-2009, 09:37 AM
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 (http://martin-weusten.de/upload/fbo-broken.html) 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?

Coolcat
12-29-2009, 05:36 AM
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 (http://dev.chromium.org/getting-involved/dev-channel) version, which is obviously something else...

giles
12-29-2009, 02:13 PM
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!