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

Re: [Public WebGL] WebGL spec modifications for D3D



On 2010-04-23 00:53, Chris Marrin wrote:
On Apr 22, 2010, at 12:18 PM, Vangelis Kokkevis wrote:

...4. Conflicting constant color usage. In D3D we can't directly support alpha blending for the cases where the source blend function is set to GL_CONSTANT_ALPHA (or GL_ONE_MINUS_CONSTANT_ALPHA), and the destination blend function is set to GL_CONSTANT_COLOR, or vice versa. That's because GL_CONSTANT_ALPHA has no D3D9 equivalent and if we replicate the alpha to the RGB components we can no longer use the RGB components for the other blend function. Spec change:
a) completely remove support for GL_CONSTANT_ALPHA and ONE_MINUS_CONSTANT_ALPHA (ie return GL_INVALID_VALUE), -or-
b) glBlendFunc/Separate sets GL_INVALID_OPERATION if a source function is GL_CONSTANT_ALPHA or GL_ONE_MINUS_CONSTANT_ALPHA and the corresponding destination function is GL_CONSTANT_COLOR or or GL_ONE_MINUS_CONSTANT_COLOR, or vice versa.
I haven't thought about this one enough, but it makes me a little concerned. If I want to fade out an object by turning constant alpha down to 0, I can't do that? I suppose I can do the same thing by passing an alpha value to the shader. But couldn't there be alpha blending optimizations we could be missing by doing that? Like I said, I haven't thought about this enough, so maybe these concerns are nothing to worry about.

The limitation would be that you cannot use constant alpha and color at the same time. So the ones you cannot use would be:

blendFunc((ONE_MINUS_)CONSTANT_ALPHA, (ONE_MINUS_)CONSTANT_COLOR)
blendFunc((ONE_MINUS_)CONSTANT_COLOR, (ONE_MINUS_)CONSTANT_ALPHA)

You would still be able to use for example

blendFunc(CONSTANT_ALPHA, ONE_MINUS_CONSTANT_ALPHA)


Dropping constant alpha would not limit what you can do more than dropping constant alpha and constant color at the same time, you would just have to set blendColor(a, a, a, a) and use constant color.


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