Function gfx_window_glutin::init_existing [] [src]

pub fn init_existing<Cf, Df>(
    window: &GlWindow
) -> (Device, Factory, RenderTargetView<R, Cf>, DepthStencilView<R, Df>) where
    Cf: RenderFormat,
    Df: DepthFormat

Initialize with an existing Glutin window. Generically parametrized version over the main framebuffer format.

Example (using Piston to create the window)

Be careful when using this code, it's not being tested!
extern crate piston;
extern crate glutin_window;
extern crate gfx_window_glutin;

// Create window with Piston
let settings = piston::window::WindowSettings::new("Example", [800, 600]);
let mut glutin_window = glutin_window::GlutinWindow::new(&settings).unwrap();

// Initialise gfx
let (mut device, mut factory, main_color, main_depth) =
    gfx_window_glutin::init_existing::<ColorFormat, DepthFormat>(&glutin_window.window);

let mut encoder: gfx::Encoder<_, _> = factory.create_command_buffer().into();