Skip to content

Commit aac015c

Browse files
N39: glutin (#1195)
Co-authored-by: Joe Clay <[email protected]>
1 parent 26761d6 commit aac015c

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

content/news/039/index.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,66 @@ it is expected to land sometime during November.
385385

386386
## Library Updates
387387

388+
### [glutin]
389+
390+
[glutin] ([GitHub][glutin-github], [docs.rs][glutin-docs])
391+
by [@kchibisov] ([rust-windowing]) is a crate that is well known for
392+
being an OpenGL platform initialization on top of winit.
393+
394+
With glutin `0.30`, this is no longer the case. The crate was
395+
rewritten from scratch and redesigned around [raw-window-handle], so
396+
you don't need [winit] anymore in this equation and it could be used with
397+
whatever windowing library you prefer, like [smithay-client-toolkit] for
398+
pure Wayland clients.
399+
400+
Given everything is based on raw-window-handle the crate is more low-level
401+
now and also exposes the underlying platform API like `EGL`, `GLX`, and `WGL`
402+
directly. There's already an interest of using glutin to handle `EGL` in
403+
projects like [Smithay].
404+
405+
Previously with glutin `0.29` everything was based around the single
406+
[`WindowedContext`] - while this was convinient for some users and worked on
407+
desktop platforms, that fact was a major pain on Android where the window
408+
gets destroyed over time, but its context could be kept around, or when you
409+
fail to query configuration with supplied parameters leading to chain creating
410+
`WindowedContext` and causing delays on startup. For example, you can create all
411+
the objects and then fail on setting vsync, forcing you to start over.
412+
413+
None of that is an issue with glutin `0.30.0`. The API is now structured around
414+
`Display`, `Context`, `Surface`, and `Config`, where every object is built from
415+
the `Display` and has its own role which is close to what you usually can find
416+
in OpenGL native rendering platforms specifications, like `EGL`.
417+
418+
Unfortunatelly, the new API isn't as easy to bootstrap as it was with old
419+
glutin, especially when you want to use platforms like `WGL` and `GLX`.
420+
However, if you're using winit there will be (or is already) a special crate
421+
[glutin-winit] to handle platform-specific `Display` creation for you.
422+
423+
To see the new API in action, look at the [glutin examples]. They
424+
should work on desktop platforms and Android (you may even notice that there's
425+
no special code for Android at all!).
426+
427+
One note to add, is that iOS is **no longer** supported, but only due to
428+
lack of maintainers for it. If you rely on iOS support in glutin, the devs
429+
encourage you to help contributing to it upstream, or you'd stuck with glutin
430+
`0.29` which won't receive any updates anymore.
431+
432+
For further info, check out the [winit matrix room](https://matrix.to/#/#winit:matrix.org)
433+
or [#winit](https://web.libera.chat/#winit) at libera.chat.
434+
435+
[glutin]: https://crates.io/crates/glutin
436+
[glutin examples]: https://github.com/rust-windowing/glutin/tree/master/glutin_examples
437+
[glutin-winit]: https://github.com/rust-windowing/glutin/pull/1517
438+
[winit]: https://crates.io/crates/winit
439+
[Smithay]: https://github.com/smithay/smithay
440+
[`WindowedContext`]: https://docs.rs/glutin/0.29.1/glutin/type.WindowedContext.html
441+
[smithay-client-toolkit]: https://crates.io/crates/smithay-client-toolkit
442+
[glutin-github]: https://github.com/rust-windowing/glutin
443+
[raw-window-handle]: https://crates.io/crates/raw-window-handle
444+
[glutin-docs]: https://docs.rs/glutin
445+
[@kchibisov]: https://github.com/kchibisov
446+
[rust-windowing]: https://github.com/rust-windowing
447+
388448
### [presser]
389449

390450
[presser] ([GitHub][presser-github], [docs.rs][presser-docs])

0 commit comments

Comments
 (0)