[Public WebGL] Compositing with HTML

Kenneth Waters [email protected]
Fri Jan 8 10:24:11 PST 2010

> If you do this test in WebKit it seems to do the right thing. Over white the clear color looks the same because of clamping, but over other colors the red is too bright. But if you do this in Firefox, it looks wrong. Over white, you get gray! In fact, any red component over 0.5 gives you the same result. So it looks like when Firefox gets a color component over 1.0, it replaces the entire color with black or something. Is this a bug in Firefox?

I think this is undefined behavior.  My personal preference is that
the color channels are clammed to alpha, unless its specified
differently elsewhere.  Seems like this should go into section 5.1.1
of the spec.

> Maybe there's nothing we need to do here.

OpenGL doesn't have a concept of premultiplied or unpremultiplied
alpha.  You can use OpenGL to blend in either space.  I don't think we
need to do anything about it here, beyond what we've already said in
the WebGLContextAttributes, and to define what happens for out of
range values.

> But we at least need to make a notation that clearColor does not obey the blendFunc and the values you specify go into the color buffer directly, so you need to take this into account if your color buffer is premultiplied.

I think this is spelled out quite well in the GL-ES 2.0 spec, "The GL
provides a means for setting portions of every pixel in a particular
buffer to the same value." "When Clear is called, the only
per-fragment operations that are applied (if enabled) are the pixel
ownership test, the scissor test, and dithering"  (section 4.2.3).

-- Kenneth Waters

You are currently subscribe to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:

More information about the public_webgl mailing list