Switch viewport before rendering rectangles

To make sure it is possible to draw over the complete window, the
viewport is removed before rendering rectangles now.
This makes the visual bell behave properly and flash over the padding of
the terminal too, instead of just flashing the grid.

However when rendering a rectangle now, the padding has to be taken into
consideration.
This commit is contained in:
Christian Duerr committed 2018-02-16 22:41:56 +01:00
1 parent c14128e9dc
commit b86c1ff9ed
1 file changed
+10
+10
View File
@@ -675,6 +675,9 @@ impl QuadRenderer {
// Swap program
gl::UseProgram(self.rect_program.id);
// Remove padding from viewport
gl::Viewport(0, 0, props.width as i32, props.height as i32);
// Change blending strategy
gl::BlendFunc(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);
@@ -707,6 +710,13 @@ impl QuadRenderer {
gl::BindBuffer(gl::ARRAY_BUFFER, 0);
gl::BindVertexArray(0);
// Add padding to viewport again
let x_pad = config.padding().x as i32;
let y_pad = config.padding().y as i32;
let width = props.width as i32;
let height = props.height as i32;
gl::Viewport(x_pad, y_pad, width - 2 * y_pad, height - 2 * y_pad);
// Disable program
gl::UseProgram(0);
}