PDA

View Full Version : glBlendEquationSeparate Questions.



PickleWorld
01-31-2006, 10:15 AM
Heya, I must be having one of those days because I am stumped, I am trying the following...

glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glBlendColorEXT(transp.r, transp.g, transp.b, transp.a);
glBlendEquationSeparateEXT(GL_FUNC_ADD, GL_MAX);
glBlendFuncSeparateEXT( GL_ONE_MINUS_CONSTANT_COLOR, GL_CONSTANT_COLOR, GL_ZERO, GL_CONSTANT_COLOR);I have my color channels working fine but I have been unable to get my expected results in the alpha channel. What I would expect to see is 1.0's everywhere from the glClear() except where I draw geometry where there should be transp.a?? Yet instead I get an alpha of 1.0 everywhere (no transp.a is not 1.0).

So to then simplify things I attempted...

glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glBlendColorEXT(transp.r, transp.g, transp.b, transp.a);
glBlendEquationSeparateEXT(GL_FUNC_ADD, GL_MAX);
glBlendFuncSeparateEXT( GL_ONE_MINUS_CONSTANT_COLOR, GL_CONSTANT_COLOR, GL_ZERO, GL_ZERO);With GL_ZERO in both srcAlpha and destAlpha you would expect to get 0.0 in alpha everywhere I draw geometry (max(0.0*S, 0.0*D) = 0.0) and 1.0 everywhere else (from the clear)... yet I still get 1.0 everywhere.

The color channel however is fine, I get the expected color results.

Anyone have any ideas?

(I am using an Nvidia Quadro FX 4400 with driver 7.7.1.8)

PickleWorld
01-31-2006, 10:35 AM
Nevermind, I got it.

GL_MAX gets you Ac = max(As, Ad) not Ac = max(As * Sa, Ad * Da).