Subtractive Blending using GLblendFunc

Hi. I would like to know how to make a scene darker using GLBlendFunction. I wan to add in a layer above the scene to make it darker. What GLBlendFunc can i use for this ?

Thanks

See glBlendEquation, with GL_FUNC_SUBTRACT.

Is there any other way without the use of glblendEquation ?

Is there something wrong with glBlendEquation? That’s generally how you set up different blending equations.

And no, if you want to actually subtract color, then you must use glBlendEquation. You can make a scene darker just by doing traditional alpha blending with black, but that is not even remotely close to how it works physically.

i see. I am not too sure that opengles for android offers glblendequation . So am looking for other approchs.

Does these
glBlendFunc( GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA );
with dark color rectangles stimulate the scene darkening ?

Then you should have mentioned that you were using GL ES. Did you read the Posting Guidelines?

In any case, ES 2.0 does have glBlendEquation. ES 1.1 does not, but it does have an extension for it. So you can check the hardware you’re interested in to see if it is worthwhile.

with dark color rectangles stimulate the scene darkening ?

That’s a nonsensical blend mode. If you want to multiplicatively darken the scene by some value, put that value in the alpha and do:

glBlendFunc(GL_ZERO, GL_SRC_ALPHA);

ic . I am currently working on a windows version using opengl before i port to mobile. So am looking on a future basis.

Will try the using the alpha values.