1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Add glow::Context to epi::Frame (#1425)

This can be used, for instance, to:

* Render things to offscreen buffers.
* Read the pixel buffer from the previous frame (glow::Context::read_pixels).
* Render things behind the egui windows.
This commit is contained in:
Emil Ernerfeldt
2022-03-27 15:20:45 +02:00
committed by GitHub
parent b7ebe16cfb
commit 8f178fa4e0
10 changed files with 52 additions and 27 deletions

View File

@@ -627,11 +627,16 @@ impl Painter {
}
}
pub fn clear(gl: &glow::Context, dimension: [u32; 2], clear_color: egui::Rgba) {
pub fn clear(gl: &glow::Context, screen_size_in_pixels: [u32; 2], clear_color: egui::Rgba) {
unsafe {
gl.disable(glow::SCISSOR_TEST);
gl.viewport(0, 0, dimension[0] as i32, dimension[1] as i32);
gl.viewport(
0,
0,
screen_size_in_pixels[0] as i32,
screen_size_in_pixels[1] as i32,
);
let clear_color: Color32 = clear_color.into();
gl.clear_color(