#Windows transparant window doesn't seem to work

10 messages · Page 1 of 1 (latest)

pulsar idol
#

I have some code to display some things on a transparant window like this:

fn main() { App::new() .add_plugins(DefaultPlugins.set(WindowPlugin { primary_window: Some(Window { // Setting transparentallows theClearColor`'s alpha value to take effect
transparent: true,
// Disabling window decorations to make it feel more like a widget than a window
decorations: false,
resolution: WindowResolution::new(WINDOW_WIDTH, WINDOW_HEIGHT),
#[cfg(target_os = "macos")]
composite_alpha_mode: CompositeAlphaMode::PostMultiplied,
#[cfg(target_os = "linux")]
composite_alpha_mode: CompositeAlphaMode::PreMultiplied,
..default()
}),
..default()
}))
// ClearColor must have 0 alpha, otherwise some color will bleed through
.insert_resource(ClearColor(Color::NONE))
//also update system to display some stuff
.add_systems(Startup, setup)
.run();
}

fn setup(mut commands: Commands) {
commands.spawn(Camera2d);
}`

On my mac this worked nicely, but today I tried it on my windows pc and it gives a black background instead. I see that theres some special code that's only used for mac and not for windows, but I based myself on https://github.com/bevyengine/bevy/blob/latest/examples/window/transparent_window.rs so I thought there would be a good reason that windows wasn't included? Any ideas on how to resolve this? If I use the composit alpha mode for mac I get an error that only Opaque is possible and that also gives me a black background...

GitHub

A refreshingly simple data-driven game engine built in Rust - bevyengine/bevy

blissful latch
#

did you try rust #[cfg(target_os = "windows")] composite_alpha_mode: CompositeAlphaMode::PreMultiplied, or```rust
#[cfg(target_os = "windows")]
composite_alpha_mode: CompositeAlphaMode::PostMultiplied,

pulsar idol
#

Then I just get this error 😦

.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-23.0.1\src\backend\wgpu_core.rs:719:18:
Error in Surface::configure: Validation Error

Caused by:
Requested alpha mode PreMultiplied is not in the list of supported alpha modes: [Opaque]

stuck bluff
#

Sadly, it doesn't work for a long time on Windows. There were one or two issues opened on github for it.

analog galleon
#

Well atleast someone currently has the same problem, was hoping for an easy solution because i was planning a little project that basically depended on this.
I'll keep looking and get back here when I find something CryThumbsUp

analog galleon
rain flume
#

Yeah, I have a working thing in godot as well, just wanted to see if it was possible in bevy...

rain flume
#

Seems to be a driver issue not winit/wgpu