#gamedev #graphics #gfx #glutin

old_school_gfx_glutin_ext

Extensions for glutin to initialize & update old school gfx

15 releases (breaking)

0.32.0 Oct 24, 2023
0.31.0 Feb 4, 2023
0.30.2 Jan 27, 2023
0.30.1 Dec 22, 2022
0.24.0 Mar 12, 2020

#220 in Graphics APIs

Download history 628/week @ 2023-08-05 670/week @ 2023-08-12 510/week @ 2023-08-19 471/week @ 2023-08-26 495/week @ 2023-09-02 608/week @ 2023-09-09 569/week @ 2023-09-16 194/week @ 2023-09-23 423/week @ 2023-09-30 519/week @ 2023-10-07 641/week @ 2023-10-14 743/week @ 2023-10-21 706/week @ 2023-10-28 647/week @ 2023-11-04 584/week @ 2023-11-11 653/week @ 2023-11-18

2,707 downloads per month
Used in 17 crates (5 directly)

Apache-2.0

22KB
256 lines

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 event_loop = winit::event_loop::EventLoop::new();
let window_builder = winit::window::WindowBuilder::new();

// 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_builder)
    .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.

Dependencies

~3–16MB
~225K SLoC