Function gfx_window_glutin::init

source ·
pub fn init<Cf, Df>(
    window: WindowBuilder,
    context: ContextBuilder<'_>,
    events_loop: &EventsLoop
) -> Result<(GlWindow, Device, Factory, RenderTargetView<R, Cf>, DepthStencilView<R, Df>), CreationError>where
    Cf: RenderFormat,
    Df: DepthFormat,
Expand description

Initialize with a window builder. Generically parametrized version over the main framebuffer format.

Example

extern crate gfx_core;
extern crate gfx_device_gl;
extern crate gfx_window_glutin;
extern crate glutin;

use gfx_core::format::{DepthStencil, Rgba8};

fn main() {
    let events_loop = glutin::EventsLoop::new();
    let window_builder = glutin::WindowBuilder::new().with_title("Example".to_string());
    let context = glutin::ContextBuilder::new();
    let (window, device, factory, rtv, stv) =
        gfx_window_glutin::init::<Rgba8, DepthStencil>(window_builder, context, &events_loop)
            .expect("Failed to create window");

    // your code
}