Setting transparent background with conrod

I'm playing with the examples in conrod and trying to set a transparent background. For the list_select example, for instance, I changed

widget::Canvas::new().color(conrod_core::color::BLUE).set(ids.canvas, ui);

into

widget::Canvas::new().color(conrod_core::color::TRANSPARENT).set(ids.canvas, ui);

but instead of transparent background I get an opaque black background.

(transparent terminal on left, conrod example on right)

This is true regardless of the opacity value passed to target.clear_color(). Any ideas?

Did you make the window itself transparent?

Is that handled by conrod or by the window manager? if conrod, how does one set window opacity? Would something like this work:

 let mut ui = conrod_core::UiBuilder::new([WIDTH as f64, HEIGHT as f64])
                  .theme(conrod::theme::Theme {background_color: conrod_core::color::TRANSPARENT, ..Default::default()})
                  .build();

So using a theme with transparent background does not solve it. When the window is built I have added with_transparency(true) which generates the error

thread 'main' panicked at 'called Result::unwrap() on an Err value: GlutinCreationError(NoAvailablePixelFormat)', src/libcore/result.rs:1084:5
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace.

If I set it to false then it runs fine but with an opaque background. I'm using X11 on Manjaro Linux with OpenGL version 3.0 Mesa 19.1.3. Getting the glium::glutin::GL_CORE for the app returns Specific(OpenGl, (3, 2)). Not sure if that is relevant.

not sure how to do that in conrod, but the window system compositor needs to be told hat you want the window to have alpha transparency

if conrod, how does one set window opacity?

"window opacity" is different thing as it implies the entire window is made partially transparent, not just the parts your application wants to be (the background) using the alpha channel

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.