Skip to content
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

Update to glutin v0.21.0 #157

Closed
iceiix opened this issue May 16, 2019 · 2 comments · Fixed by #160
Closed

Update to glutin v0.21.0 #157

iceiix opened this issue May 16, 2019 · 2 comments · Fixed by #160

Comments

@iceiix
Copy link
Owner

iceiix commented May 16, 2019

Glutin v0.21.0 migration guide: https://gentz.rocks/posts/glutin-v0-21-0-migration-guide/

@iceiix
Copy link
Owner Author

iceiix commented May 19, 2019

Currently using a minor fork of glutin, iceiix/glutin#1
Updating to 0.21.0, errors:

error[E0432]: unresolved import `glutin::ContextTrait`
  --> src/gl/mod.rs:16:5
   |
16 | use glutin::ContextTrait;
   |     ^^^^^^^^^^^^^^^^^^^^ no `ContextTrait` in the root. Did you mean to use `ContextError`?

error[E0432]: unresolved import `glutin::ContextTrait`
  --> src/main.rs:55:5
   |
55 | use glutin::ContextTrait;
   |     ^^^^^^^^^^^^^^^^^^^^ no `ContextTrait` in the root. Did you mean to use `ContextError`?

warning: unused import: `glutin::ContextTrait`
  --> src/gl/mod.rs:16:5
   |
16 | use glutin::ContextTrait;
   |     ^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(unused_imports)] on by default

warning: unused import: `glutin::ContextTrait`
  --> src/main.rs:55:5
   |
55 | use glutin::ContextTrait;
   |     ^^^^^^^^^^^^^^^^^^^^

error[E0107]: wrong number of type arguments: expected 1, found 0
   --> src/main.rs:358:37
    |
358 | fn handle_window_event(window: &mut glutin::WindowedContext,
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^ expected 1 type argument

error[E0107]: wrong number of type arguments: expected 1, found 0
  --> src/gl/mod.rs:25:20
   |
25 | pub fn init(vid: & glutin::WindowedContext) {
   |                    ^^^^^^^^^^^^^^^^^^^^^^^ expected 1 type argument

error: aborting due to 4 previous errors

Some errors occurred: E0107, E0432.
For more information about an error, try `rustc --explain E0107`.
error: Could not compile `stevenarella`.

@iceiix
Copy link
Owner Author

iceiix commented May 19, 2019

Removing the context trait imports is easy enough, but how to resolve the missing type arguments on WindowedContext? Added <T>, the compiler suggests adding where T: glutin::context::ContextCurrentState bounds but module context is private. (fixed: re-exported as glutin::ContextCurrentState) This is part of the "new context currency system":

  • Added two new types, NotCurrent and PossiblyCurrent, which RawContext, WindowedContext and Context are now generic over.
  • ContextBuilder is also generic over those two types.
  • Which type it’s generic over depends on the currency state of the context you intend to share it with, not, as some have mistakenly thought, the currency in which the new context will be made. The new context will always be NotCurrent.

https://docs.rs/glutin/0.21.0/glutin/type.WindowedContext.html
https://docs.rs/glutin/0.21.0/glutin/struct.ContextWrapper.html

https://github.com/rust-windowing/glutin/blob/2662698ab872c8c56d052fb920baa6b854328293/glutin/src/windowed.rs#L98

impl<T: ContextCurrentState> WindowedContext<T> {

iceiix added a commit that referenced this issue May 20, 2019
Updating the glutin dependency to a 0.21.0-based branch, based on the migration guide at:
https://gentz.rocks/posts/glutin-v0-21-0-migration-guide/

* Remove glutin::ContextTrait

* Create window with ContextBuilder instead of WindowedContext::new

* Add .window() accessor on WindowContext, since it now dereferences to Context

In order to not break wasm32-unknown-unknown compilation, a minor fork is used of glutin v0.21.0 and a corresponding version of winit: iceiix/glutin#1 iceiix/winit#2
 - with stubs to compile (but not run, see issue #115)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant