Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use correct alpha blending function #756

Merged
merged 1 commit into from Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions imgui-glium-renderer/src/lib.rs
Expand Up @@ -9,8 +9,8 @@ use glium::uniforms::{
MagnifySamplerFilter, MinifySamplerFilter, Sampler, SamplerBehavior, SamplerWrapFunction,
};
use glium::{
program, uniform, vertex, Blend, DrawError, DrawParameters, IndexBuffer, Program, Rect,
Surface, Texture2d, VertexBuffer,
program, uniform, vertex, Blend, BlendingFunction, DrawError, DrawParameters, IndexBuffer,
LinearBlendingFactor, Program, Rect, Surface, Texture2d, VertexBuffer,
};
use imgui::internal::RawWrapper;
use imgui::{BackendFlags, DrawCmd, DrawCmdParams, DrawData, TextureId, Textures};
Expand Down Expand Up @@ -253,7 +253,13 @@ impl Renderer {
tex: Sampler(texture.texture.as_ref(), texture.sampler)
},
&DrawParameters {
blend: Blend::alpha_blending(),
blend: Blend {
alpha: BlendingFunction::Addition {
source: LinearBlendingFactor::One,
destination: LinearBlendingFactor::OneMinusSourceAlpha,
},
..Blend::alpha_blending()
},
scissor: Some(Rect {
left: f32::max(0.0, clip_rect[0]).floor() as u32,
bottom: f32::max(0.0, fb_height - clip_rect[3]).floor()
Expand Down