Fix alpha blending in the gl renderer

This commit is contained in:
Simon Hausmann 2020-05-06 09:51:15 +02:00
parent 8896364809
commit c41cb3e179

View file

@ -192,6 +192,9 @@ impl GraphicsFrame for GLFrame {
fn render_primitive(&mut self, primitive: &OpaqueRenderingPrimitive, transform: &Matrix4<f32>) {
let matrix: [[f32; 4]; 4] = (self.root_matrix * transform).into();
let draw_params =
glium::DrawParameters { blend: glium::Blend::alpha_blending(), ..Default::default() };
match &primitive.0 {
GLRenderingPrimitive::FillPath { ref vertices, ref indices, style } => {
let (r, g, b, a) = match style {
@ -203,7 +206,7 @@ impl GraphicsFrame for GLFrame {
};
self.glium_frame
.draw(vertices, indices, &self.path_program, &uniforms, &Default::default())
.draw(vertices, indices, &self.path_program, &uniforms, &draw_params)
.unwrap();
}
GLRenderingPrimitive::Texture { texture, vertices } => {
@ -215,7 +218,7 @@ impl GraphicsFrame for GLFrame {
};
self.glium_frame
.draw(vertices, &indices, &self.image_program, &uniforms, &Default::default())
.draw(vertices, &indices, &self.image_program, &uniforms, &draw_params)
.unwrap();
}
}