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

Transparent window support #385

Open
mitchmindtree opened this issue Aug 17, 2019 · 4 comments
Open

Transparent window support #385

mitchmindtree opened this issue Aug 17, 2019 · 4 comments
Labels

Comments

@mitchmindtree
Copy link
Member

mitchmindtree commented Aug 17, 2019

It seems that since switching to Vulkan it's not as trivial to get a transparent window working!

Expected behaviour

You should be able to create a transparent window like this:

app.new_window()
    .with_transparency(true)
    .build()

Actual behaviour

The above results in a black screen. This is likely due to the default CompositeAlpha::Opaque value specified when building the window's swapchain. We can override this with the following:

app.new_window()
    .with_transparency(true)
    .swapchain_builder({
        window::SwapchainBuilder::default()
            .composite_alpha(vk::swapchain::CompositeAlpha::PostMultiplied)
    })
    .build()

However so far on my Linux machine with mesa intel vulkan driver the PostMultiplied value is not supported and results in a panic!:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SwapchainCreation(UnsupportedCompositeAlpha)'

Possible solutions

  • Investigate the state of support for the PostMultiplied composite value across Vulkan implementations in the wild.
  • Check that the incompatibility is not due to some other specified swapchain parameter like ColorSpace or Format.
  • Wait for the switch to rendy and address the issue then to avoid duplicate work.
@mitchmindtree
Copy link
Member Author

Seems to also be the case on the following systems:

  • Ubuntu 18.04 with an i7 and a GTX970 graphics card (I think with proprietary drivers).
  • Win 10 with a GTX 1050 card.

@zperk13
Copy link

zperk13 commented Oct 25, 2022

Having basically the same issue.
Nannou version: 0.18.1
Windows 10 with GTX 1080

I have this code in my mode(&App) function

app
  .new_window()
  .fullscreen()
  .transparent(true)
  .always_on_top(true)
  .view(view)
  .build()
  .unwrap();

and the window has a black background. Theere is no code in my view(...) function drawing a background

@danwilhelm
Copy link
Contributor

@zperk13 I verified this does indeed happen on Windows 10 w/ GTX 1080. For now, just replace fullscreen() with maximized() and make sure you're clearing with a transparent alpha, e.g. draw.background().color(rgba(0.0, 0.0, 0.0, 0.0));.

Other than that, it seems very likely to be a winit issue. There are multiple reports of this here: rust-windowing/winit#2502 ("undecorated" means a window without title bar/etc).

@dirkjf
Copy link

dirkjf commented Dec 2, 2022

Same issue on Linux with X11. Not sure if this is a winit issue, for creating a window with a transparent background with just winit is not a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants