Thanks to visit codestin.com
Credit goes to github.com

Skip to content

imgui-glium-renderer has wrong alpha blending settings #733

@Lateasusual

Description

@Lateasusual

The winit Blend::alpha_blending() used in the glium renderer backend produces an incorrect blending function for our purposes.

Winit provides (and imgui-glium-renderer uses):

alpha: BlendingFunction::Addition {
    source: LinearBlendingFactor::SourceAlpha,
    destination: LinearBlendingFactor::OneMinusSourceAlpha
},

where the correct function for "overlay" alpha blending should be

alpha: BlendingFunction::Addition {
    source: LinearBlendingFactor::One,
    destination: LinearBlendingFactor::OneMinusSourceAlpha,
},

Screenshots:

Without the change - even though the window background is fully opaque, the drawn imgui windows overwrite the alpha with an incorrect value.
image

With the change, the window opacity is preserved as expected.
image

If this is not intentional (which i presume it isn't) and is not deemed to be a mistake in winit upstream then I will submit a PR later when I get the chance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions