SDL2 texture blend help

Ivan Trombley itrombley at dot-borg.org
Mon Dec 11 04:57:44 UTC 2017


Experimenting with compositing images in SDL2, I get a dark edge 
around my textures. In the image below, you can see the top 
example where I composite the cyan image on top of the 
blue/magenta image looks correct but the bottom example, which is 
done using SDL_RenderCopy is not correct.

http://a4.pbase.com/o10/09/605909/1/166698494.lCoVTgcI.example.png

I tried premultiplying the the colors in the cyan image and 
setting the blend function as such...

   SDL_SetTextureBlendMode(texture, SDL_ComposeCustomBlendMode(
       SDL_BlendFactor.SDL_BLENDFACTOR_ONE,
       SDL_BlendFactor.SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
       SDL_BlendOperation.SDL_BLENDOPERATION_ADD,
       SDL_BlendFactor.SDL_BLENDFACTOR_ONE,
       SDL_BlendFactor.SDL_BLENDFACTOR_ONE,
       SDL_BlendOperation.SDL_BLENDOPERATION_ADD));

...but that produces the exact same thing.


Any SDL experts out there that can give me a clue?



More information about the Digitalmars-d mailing list