4

I am currently trying to use piston_window and just need to know how to make my piston_window transparent. I know that glutin_window supports with_transparency on it's window builder, but I don't know how I could set that.

Relevant code:

extern crate piston_window;

use piston_window::*;

fn main() {
    let opengl = OpenGL::V3_2;

    let mut window: PistonWindow =
        WindowSettings::new("Transparent test", [800, 600])
        .opengl(opengl)
        .vsync(true)
        .resizable(false)
        .decorated(false)
        .exit_on_esc(true)
        .build()
        .unwrap();

    window.set_lazy(true);

    while let Some(e) = window.next() {
        window.draw_2d(&e, |c, g| {
            clear(color::TRANSPARENT, g);
            // ...
        });
    }
}

I don't need any support for Windows or macOS. Therefore a way to do it with the glutin_window backend would be good enough for me.

Scrumplex
  • 522
  • 1
  • 6
  • 15

0 Answers0