"equally blended" problem

Hello all!!!

My problem is very simple.

I have a scene composed by multiple textured GL_QUADS and I want to equally blend them. (as doing Enblend for example Enblend/Enfuse )

1)the sequence:


glBlendEquation(GL_FUNC_ADD)
glBlendFunc(GL_ONE,GL_ZERO);
draw(obj_A);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColor3f( *, *, *, 0.5f);
draw(obj_B)

doesn’t work because the part of obj_B outside obj_A is blended with the background.

2)the sequence:


glBlendColor(0.0,0.0,0.0,0.5);
glBlendEquationSeparate(GL_FUNC_ADD,GL_MAX);
glBlendFuncSeparate(GL_ONE_MINUS_DST_ALPHA,GL_DST_ALPHA,GL_CONSTANT_ALPHA,GL_DST_ALPHA);
draw(obj_A);
draw(obj_B);

may work but is not implemented on my graphic card (need 2.0).

Is there exist a simple way to achieve this?

Thanks.

// to fill in the blanks
glDisable(GL_BLEND);
draw(obj_B)
draw(obj_A);

// blend
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD)
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColor3f( *, *, *, 0.5f);
draw(obj_B)

For more involved stuff, a GLSL fragment shader will be way easier and more powerful.

I finally found a simple solution:


glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE_MINUS_DST_ALPHA,GL_DST_ALPHA);
glColor4f(1.0f,1.0f,1.0f,0.5f);
draw(obj_A);
draw(obj_B);
draw(obj_C);
...

thanks a lot!