Skip to content

N39: glutin #1195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 7, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions content/news/039/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,66 @@ it hit version 0.28 which added new functionality and improved existing:

## Library Updates

### [glutin]

[glutin] ([GitHub][glutin-github], [docs.rs][glutin-docs])
by [@kchibisov] ([rust-windowing]) is a crate that is well known for
being an OpenGL platform initialization on top of winit.

With glutin `0.30`, this is no longer the case. The crate was
rewritten from scratch and redesigned around [raw-window-handle], so
you don't need [winit] anymore in this equation and it could be used with
whatever windowing library you prefer, like [smithay-client-toolkit] for
pure Wayland clients.

Given everything is based on raw-window-handle the crate is more low-level
now and also exposes the underlying platform API like `EGL`, `GLX`, and `WGL`
directly. There's already an interest of using glutin to handle `EGL` in
projects like [Smithay].

Previously with glutin `0.29` everything was based around the single
[`WindowedContext`] - while this was convinient for some users and worked on
desktop platforms, that fact was a major pain on Android where the window
gets destroyed over time, but its context could be kept around, or when you
fail to query configuration with supplied parameters leading to chain creating
`WindowedContext` and causing delays on startup. For example, you can create all
the objects and then fail on setting vsync, forcing you to start over.

None of that is an issue with glutin `0.30.0`. The API is now structured around
`Display`, `Context`, `Surface`, and `Config`, where every object is built from
the `Display` and has its own role which is close to what you usually can find
in OpenGL native rendering platforms specifications, like `EGL`.

Unfortunatelly, the new API isn't as easy to bootstrap as it was with old
glutin, especially when you want to use platforms like `WGL` and `GLX`.
However, if you're using winit there will be (or is already) a special crate
[glutin-winit] to handle platform-specific `Display` creation for you.

To see the new API in action, look at the [glutin examples]. They
should work on desktop platforms and Android (you may even notice that there's
no special code for Android at all!).

One note to add, is that iOS is **no longer** supported, but only due to
lack of maintainers for it. If you rely on iOS support in glutin, the devs
encourage you to help contributing to it upstream, or you'd stuck with glutin
`0.29` which won't receive any updates anymore.

For further info, check out the [winit matrix room](https://matrix.to/#/#winit:matrix.org)
or [#winit](https://web.libera.chat/#winit) at libera.chat.

[glutin]: https://crates.io/crates/glutin
[glutin examples]: https://github.com/rust-windowing/glutin/tree/master/glutin_examples
[glutin-winit]: https://github.com/rust-windowing/glutin/pull/1517
[winit]: https://crates.io/crates/winit
[Smithay]: https://github.com/smithay/smithay
[`WindowedContext`]: https://docs.rs/glutin/0.29.1/glutin/type.WindowedContext.html
[smithay-client-toolkit]: https://crates.io/crates/smithay-client-toolkit
[glutin-github]: https://github.com/rust-windowing/glutin
[raw-window-handle]: https://crates.io/crates/raw-window-handle
[glutin-docs]: https://docs.rs/glutin
[@kchibisov]: https://github.com/kchibisov
[rust-windowing]: https://github.com/rust-windowing

### [presser]

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