old_school_gfx_glutin_ext

Crates.ioold_school_gfx_glutin_ext
lib.rsold_school_gfx_glutin_ext
version0.34.0
sourcesrc
created_at2020-01-31 23:44:51.254485
updated_at2024-06-23 09:26:34.182913
descriptionExtensions for glutin to initialize & update old school gfx
homepage
repositoryhttps://github.com/alexheretic/old-school-gfx-glutin-ext
max_upload_size
id203805
size79,781
Alex Butler (alexheretic)

documentation

README

old_school_gfx_glutin_ext crates.io Documentation

Initialise & update old school gfx with glutin + winit.

type ColorFormat = gfx::format::Srgba8;
type DepthFormat = gfx::format::DepthStencil;

let window_attrs = winit::window::Window::default_attributes();

// Initialise winit window, glutin context & gfx views
let old_school_gfx_glutin_ext::Init {
    // winit window
    window,
    // glutin bits
    gl_config,
    gl_surface,
    gl_context,
    // gfx bits
    mut device,
    mut factory,
    mut color_view,
    mut depth_view,
    ..
} = old_school_gfx_glutin_ext::window_builder(&event_loop, window_attrs)
    .build::<ColorFormat, DepthFormat>()?;

// Update gfx views, e.g. after a window resize
old_school_gfx_glutin_ext::resize_views(new_size, &mut color_view, &mut depth_view);

Example

cargo run --example triangle

Minimum supported rust compiler

All crates maintained with latest stable rust.

Commit count: 34

cargo fmt