mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Use premultiplied alpha for all colors + improve painting of thin lines
This commit is contained in:
@@ -97,7 +97,7 @@ impl Painter {
|
||||
if (v_pos.x > v_clip_rect.z) { discard; }
|
||||
if (v_pos.y > v_clip_rect.w) { discard; }
|
||||
gl_FragColor = v_color;
|
||||
gl_FragColor.a *= texture2D(u_sampler, v_tc).a;
|
||||
gl_FragColor *= texture2D(u_sampler, v_tc).a;
|
||||
}
|
||||
"#,
|
||||
)?;
|
||||
@@ -163,7 +163,7 @@ impl Painter {
|
||||
let gl = &self.gl;
|
||||
|
||||
gl.enable(Gl::BLEND);
|
||||
gl.blend_func(Gl::SRC_ALPHA, Gl::ONE_MINUS_SRC_ALPHA);
|
||||
gl.blend_func(Gl::ONE, Gl::ONE_MINUS_SRC_ALPHA); // premultiplied alpha
|
||||
gl.use_program(Some(&self.program));
|
||||
gl.active_texture(Gl::TEXTURE0);
|
||||
gl.bind_texture(Gl::TEXTURE_2D, Some(&self.texture));
|
||||
|
||||
Reference in New Issue
Block a user