SDL2 texture blend help

Ivan Trombley itrombley at dot-borg.org
Tue Dec 12 06:27:30 UTC 2017


On Tuesday, 12 December 2017 at 03:34:51 UTC, Dmitry wrote:
> On Tuesday, 12 December 2017 at 03:32:05 UTC, Ivan Trombley 
> wrote:
>> It turns out that it's an issue with the color channels being 
>> in sRGB color space and the alpha channel being linear. I 
>> verified this by doing a software blend of the images and then 
>> doing another software blend using gamma corrected values.
>>
>> There's a setting in opengl to correct for it, 
>> glEnable(GL_FRAMEBUFFER_SRGB), but I haven't tried this yet.
>
> BTW, also you could use bleeding (for example, 
> https://github.com/dmi7ry/alpha-bleeding-d )

This isn't a scaling problem (which is totally solved by 
pre-multiplying the alpha with the colors BTW). This is a gamma 
correction problem which is solved only by converting the color 
values to linear color space before compositing and then 
converting the final pixel back to sRGB.



More information about the Digitalmars-d mailing list