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

Re: [Public WebGL] WebGL spec modifications for D3D





On Fri, Apr 30, 2010 at 10:53 AM, Chris Marrin <cmarrin@apple.com> wrote:

On Apr 30, 2010, at 10:18 AM, Vangelis Kokkevis wrote:

>
>
> ...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.
>
> Just to clarify, the situation is identical for both blendFunc and blendFuncSeparate, in that we cannot allow _both_ CONSTANT_ALPHA and CONSTANT_COLOR to be used as argument values in a single call.  This is not a major limitation but definitely something a developer needs to watch out for. In fact ANGLE has already implemented option (b):
>
>
> http://code.google.com/p/angleproject/source/browse/trunk/src/libGLESv2/libGLESv2.cpp#427
>
> Unless there are any objections, I'd like to move forward with stating in the WebGL spec that using both CONSTANT_ALPHA and CONSTANT_COLOR in a single call to blendFunc and blendFuncSeperate is not allowed and will set a GL_INVALID_OPERATION error.

But I'm still confused about blendFuncSeparate. Seems like I should be able to say:

       blendFuncSeparate(..., CONSTANT_COLOR, ..., CONSTANT_ALPHA)

Since they are dealing with RGB and alpha separately.

You are right!  The limitation only applies for the RGB factors in the case of blendFuncSeparate. So, to summarize, we will set GL_INVALID_OPERATION in the following cases:

* blendFunc(sFactor, dFactor):  if one of the factors is set to (ONE_MINUS_)CONSTANT_COLOR and the other to (ONE_MINUS_)CONSTANT_ALPHA .
* blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha): if one of the RGB factors (srcRGB , dstRGB) is set to (ONE_MINUS_)CONSTANT_COLOR and the other to (ONE_MINUS_)CONSTANT_ALPHA. 


  Sorry about the confusion.

Vangelis




-----
~Chris
cmarrin@apple.com