egui_glow: clear the post-processing render target (#1658)
This commit is contained in:
parent
32ad9c29be
commit
3d5e203d86
2 changed files with 7 additions and 3 deletions
|
@ -177,8 +177,6 @@ impl DemoWindows {
|
||||||
|
|
||||||
fn mobile_ui(&mut self, ctx: &Context) {
|
fn mobile_ui(&mut self, ctx: &Context) {
|
||||||
if self.about_is_open {
|
if self.about_is_open {
|
||||||
egui::CentralPanel::default().show(ctx, |_ui| {}); // just to paint a background for the windows to be on top of. Needed on web because of https://github.com/emilk/egui/issues/1548
|
|
||||||
|
|
||||||
let screen_size = ctx.input().screen_rect.size();
|
let screen_size = ctx.input().screen_rect.size();
|
||||||
let default_width = (screen_size.x - 20.0).min(400.0);
|
let default_width = (screen_size.x - 20.0).min(400.0);
|
||||||
|
|
||||||
|
@ -276,7 +274,6 @@ impl DemoWindows {
|
||||||
|
|
||||||
/// Show the open windows.
|
/// Show the open windows.
|
||||||
fn show_windows(&mut self, ctx: &Context) {
|
fn show_windows(&mut self, ctx: &Context) {
|
||||||
egui::CentralPanel::default().show(ctx, |_ui| {}); // just to paint a background for the windows to be on top of. Needed on web because of https://github.com/emilk/egui/issues/1548
|
|
||||||
self.about.show(ctx, &mut self.about_is_open);
|
self.about.show(ctx, &mut self.about_is_open);
|
||||||
self.demos.windows(ctx);
|
self.demos.windows(ctx);
|
||||||
self.tests.windows(ctx);
|
self.tests.windows(ctx);
|
||||||
|
|
|
@ -288,6 +288,7 @@ impl Painter {
|
||||||
(width_in_pixels, height_in_pixels)
|
(width_in_pixels, height_in_pixels)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// You are expected to have cleared the color buffer before calling this.
|
||||||
pub fn paint_and_update_textures(
|
pub fn paint_and_update_textures(
|
||||||
&mut self,
|
&mut self,
|
||||||
screen_size_px: [u32; 2],
|
screen_size_px: [u32; 2],
|
||||||
|
@ -308,6 +309,7 @@ impl Painter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Main entry-point for painting a frame.
|
/// Main entry-point for painting a frame.
|
||||||
|
///
|
||||||
/// You should call `target.clear_color(..)` before
|
/// You should call `target.clear_color(..)` before
|
||||||
/// and `target.finish()` after this.
|
/// and `target.finish()` after this.
|
||||||
///
|
///
|
||||||
|
@ -339,6 +341,11 @@ impl Painter {
|
||||||
unsafe {
|
unsafe {
|
||||||
post_process.begin(screen_size_px[0] as i32, screen_size_px[1] as i32);
|
post_process.begin(screen_size_px[0] as i32, screen_size_px[1] as i32);
|
||||||
post_process.bind();
|
post_process.bind();
|
||||||
|
self.gl.disable(glow::SCISSOR_TEST);
|
||||||
|
self.gl
|
||||||
|
.viewport(0, 0, screen_size_px[0] as i32, screen_size_px[1] as i32);
|
||||||
|
// use the same clear-color as was set for the screen framebuffer.
|
||||||
|
self.gl.clear(glow::COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let size_in_pixels = unsafe { self.prepare_painting(screen_size_px, pixels_per_point) };
|
let size_in_pixels = unsafe { self.prepare_painting(screen_size_px, pixels_per_point) };
|
||||||
|
|
Loading…
Reference in a new issue