Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The background is completely transparent #5072

Open
lngex opened this issue Sep 5, 2024 · 7 comments
Open

The background is completely transparent #5072

lngex opened this issue Sep 5, 2024 · 7 comments
Labels
bug Something is broken eframe Relates to epi and eframe

Comments

@lngex
Copy link

lngex commented Sep 5, 2024

Using "Viewport Builder::with transparent(true)" to set transparency will result in shadow or translucency. I hope a function can be provided to achieve complete transparency.
图片

@jayy-ahn
Copy link

jayy-ahn commented Sep 9, 2024

Have you tried implementing fn clear_color to MyEguiApp?

impl MyEquiApp {
    fn new(...) {...}
    fn clear_color(&self, _visuals: &egui::Visuals) -> [f32; 4] {
        [0.0, 0.0, 0.0, 0.0]
    }
}

This made the window completely transparent in another project I'm working on.

@lngex
Copy link
Author

lngex commented Sep 10, 2024

Have you tried implementing fn clear_color to MyEguiApp?

impl MyEquiApp {
    fn new(...) {...}
    fn clear_color(&self, _visuals: &egui::Visuals) -> [f32; 4] {
        [0.0, 0.0, 0.0, 0.0]
    }
}

This made the window completely transparent in another project I'm working on.

Using this method will cause the window to be completely black

@lngex
Copy link
Author

lngex commented Sep 18, 2024

图片
Implement clear color and return [0,0,0,0],But the window is not transparent

@lucasmerlin lucasmerlin added eframe Relates to epi and eframe bug Something is broken labels Sep 18, 2024
@jayy-ahn
Copy link

jayy-ahn commented Sep 24, 2024

Try adding a CentralPanel with the frame filled with Color32::TRANSPARENT.

impl eframe::App for MyEguiApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        egui::Window::new("test").show(ctx, |ui| {
            ui.heading("hi");
        };
        egui::CentralPanel::default()
            .frame(egui::Frame::default().fill(Color32::TRANSPARENT))
            .show(ctx, |ui| {});
    }
    fn clear_color(...) {...}

{07AAAF92-D5E3-4545-B23A-CE1AF607BC23}

@lngex
Copy link
Author

lngex commented Sep 24, 2024

图片
I tried to do what you said, but it still didn't work as expected.

@lucasmerlin
Copy link
Collaborator

@jayy-ahn @lngex I'm curious if you're using the gl or the wgpu backend? Maybe that makes a difference?

@lngex
Copy link
Author

lngex commented Sep 24, 2024

@jayy-ahn@lngex我很好奇你是使用gl还是wgpu后端?也许这会有所不同?
I turned on the log, and the log shows the glow used.

[2024-09-24T13:38:30Z DEBUG eframe] Using the glow renderer
[2024-09-24T13:38:30Z TRACE eframe::native::run] Entering the winit event loop (run_on_demand)…
[2024-09-24T13:38:30Z TRACE eframe::native::run] winit event: NewEvents(Init)
[2024-09-24T13:38:30Z TRACE eframe::native::run] event_result: Wait
[2024-09-24T13:38:30Z TRACE eframe::native::run] winit event: Resumed
[2024-09-24T13:38:30Z DEBUG eframe::native::glow_integration] Event::Resumed

This works fine on my other computer, but on this one the background is always black

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken eframe Relates to epi and eframe
Projects
None yet
Development

No branches or pull requests

3 participants