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

[Public WebGL] webgl canvas compositing into webpage.



I just thought I'd mention this to see if anyone thinks it should be specified.

Currently the way the canvas for webgl is composited with the page is different on different browsers.

Some browsers composite with GL_CLAMP_TO_BORDER with the border set to 0,0,0,0

Others composite with GL_CLAMP_TO_EDGE

The difference is seen in the edge pixels of the canvas when the canvas's display size is larger than its backbuffer size.

Note that for 2d canvases this is also not specified and the browsers are different.  In that case Opera, Safari and Chrome use the equivalent of CLAMP_TO_EDGE and Firefox uses CLAMP_TO_BORDER.

For 3d canvases, I only tested Minefield, WebKit (ie, Safari) and Chrome. Chrome is using CLAMP_TO_EDGE, Safari and Firefox are using CLAMP_TO_BORDER.

Personally I wish this was specified and I wish it was specified as CLAMP_TO_EDGE on both 2d and 3d canvases. Without it specified you can get situations like this:

See screenshots
https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/extra/canvas-compositing-test.png
(make sure to view it at 100% otherwise your image viewer may hide the issue)

The code to see the issue is here
https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/extra/canvas-compositing-test.html

A full black canvas with a CSS solid black border seems to me like it should be all black but browsers using CLAMP_TO_BORDER will end up with an outline as they composite with the background color of the page/canvas