SDL2 texture blend help
Ivan Trombley
itrombley at dot-borg.org
Wed Dec 13 17:55:50 UTC 2017
On Wednesday, 13 December 2017 at 13:54:28 UTC, Martin Drašar
wrote:
> Dne 13.12.2017 v 4:03 Ivan Trombley via Digitalmars-d napsal(a):
>> On Wednesday, 13 December 2017 at 01:44:33 UTC, Dmitry wrote:
>>> On Tuesday, 12 December 2017 at 23:28:23 UTC, Ivan Trombley
>>> wrote:
>>>> Here's the code that produces the correct results (exactly
>>>> the same
>>>> as GIMP):
>>> Share images you used, please.
>>
>> Background image:
>> http://a4.pbase.com/o10/09/605909/1/166706859.XKZZCnSO.background.png
>>
>> Foreground image:
>> http://a4.pbase.com/o10/09/605909/1/166706860.c1yD4VWp.image.png
>>
>> Composited through SDL:
>> http://a4.pbase.com/o10/09/605909/1/166706869.wLt9RofY.sdl.png
>>
>> Composited in GIMP 2.9:
>> http://a4.pbase.com/o10/09/605909/1/166706870.S01BIhVG.gimp.png
>>
>> When composited using the code I posted looks exactly like the
>> GIMP 2.9 image.
>
> I am not sure, about the tool you use to view the images, but
> on my side (Firefox browser) the sdl and gimp output are very
> different. Maybe some gamma shenanigans going on? Maybe related
> to PNG Gamma correction...
Gamma is exactly the problem. A page back I posted some code that
will overlay the image onto the background by converting the
source and destination pixels to linear RGB, compositing them and
then converting the final pixel back to sRGB for display. That
code produces the same results as GIMP. Now I just need to figure
out how to make GL_FRAMEBUFFER_SRGB (which is supposed to do the
right thing in the GPU) work with SDL.
More information about the Digitalmars-d
mailing list