The Scene:

The effect test:

The light mask image:

I am write a demo app for the SDL API test.
I want to make a night lighting effect.

I use this method:

  1. Create a RenterTargetTexture with a Black color and set is as RenderTarget.
  2. Use SDL_BLENDMODE_ADD to draw some light mask image on the RenterTargetTexture.
  3. Set the RenderTarget back to the default an RenderCopy the RenterTargetTexture to the scene which I already draw complete before.

Every thing looks ok, only the border of the two light mask crossing is not very well.
You can see one circle black border draw into the other.

I think this is because the SDL_BLENDOPERATION_ADD.
If I use the SDL_BLENDOPERATION_MAXIMUM the black border in the other circle will be gone.
Because the white color value is greater than black color value.

But in my SDL 2.0.9 version, it not supported the SDL_BLENDOPERATION_MAXIMUM.

Maybe I can use some sepcial param to SDL_SetTextureBlendMode or SDL_SetRenderDrawBlendMode to implement the multiple light effect with no black circle border.

I just start SDL for one month, so I need some professionals give me some suggestions.