Function gfx_window_glutin::init_existing
source · pub fn init_existing<Cf, Df>(
window: &GlWindow
) -> (Device, Factory, RenderTargetView<R, Cf>, DepthStencilView<R, Df>)where
Cf: RenderFormat,
Df: DepthFormat,
Expand description
Initialize with an existing Glutin window. Generically parametrized version over the main framebuffer format.
Example (using Piston to create the window)
ⓘ
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();