-
Notifications
You must be signed in to change notification settings - Fork 60
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 =0.22.0-alpha5, remove wasm_stub #260
Conversation
This comment has been minimized.
This comment has been minimized.
Event is now generic over |
This comment has been minimized.
This comment has been minimized.
Fixed some of the errors, but what happened to grab_cursor and hide_cursor?
No mention of grab_cursor in glutin, but it can be found in winit… as new methods to migrate to, not from:
This was back in "Version 0.16.0 (2018-06-25)". Changed again in rust-windowing/winit@0df4369#diff-069ac86c0936036493207ee6822daae2L48, set_cursor_grab() |
Now compiles with no errors, a few warnings, but a bigger problem is the changing of the event loop model, from
https://docs.rs/glutin/0.22.0-alpha5/glutin/event_loop/struct.EventLoop.html#method.run
https://docs.rs/glutin/0.22.0-alpha5/glutin/event_loop/enum.ControlFlow.html Currently, we have a game loop will have to restructure these loops... let the winit event loop take control (move game logic into |
Discussion in alacritty/alacritty#2438 (comment) explains:
There is run_return: https://docs.rs/glutin/0.22.0-alpha5/glutin/platform/desktop/trait.EventLoopExtDesktop.html#tymethod.run_return - but it has serious caveats:
Trying to use run_return, it sort of works but doesn't update the game logic when no events are occurring. It will take some more work, but ought to bite the bullet and switch to |
This comment has been minimized.
This comment has been minimized.
…we use, ignoring the rest with '..'
Fixed last of the glutin warnings, now builds and runs on native. What about the web? Need to select a backend:
Which feature to select, web-sys or stdweb? The example https://github.com/grovesNL/glow/tree/master/examples/hello has both
https://www.reddit.com/r/rust/comments/e7trlf/question_whats_the_difference_between_stdweb_and/ |
Was using web-sys, but stdweb is higher level, appears simpler. Testing building with (similar to the glow hello example — not yet using glow): cargo web start --target wasm32-unknown-unknown fails, from my understanding, glutin isn't for the web — need to change to glow instead:
The old
|
The last two errors appear to be an incompatibility in winit 0.20.0 release (versus 0.20.0-alpha6):
reproduces on native, as well. https://github.com/rust-windowing/winit/commits/master has recent changes to DPI: rust-windowing/winit@3aa3880 - glutin may have to update. |
A small step for #446 🕸️ Web support, use web-sys to interface to the web. Previously, we would try to use glutin on the web, which is not supported; now glutin is only used on native: fixes #171 could not find Context in platform_impl. winit is still used on both, but the GL context is created with web-sys and glow (on the web), and created with glutin and used with glow (on native). stdweb is no longer used, being replaced by web-sys. Substantial refactoring to allow reusing the code between web/native: * settings: use VirtualKeyCode from winit, not reexported from glutin * std_or_web: remove broken localstoragefs/stdweb, add File placeholder * render: disable skin_thread on wasm since we don't have threads * gl: use glow types in gl wrapper (integers in native, but Web*Key in web) * gl: web-sys WebGlUniformLocation does not implement Copy trait, so glow::UniformLocation doesn't so gl::Uniform can't * gl: refactor context initialization, pass glow::Context to gl::init for consistency between native/web * gl: update to glow with panicking tex_image_2d_multisample web-sys wrapper * glsl: use shader version in GLSL for WebGL 2 and OpenGL 3.2 * shaders: add explicit float/int type conversions, required for WebGL * shaders: specify mediump precision, required for WebGL * shaders: specify fragment shader output locations for WebGL * main: refactor handle_window_event to take a winit window, not glutin context * main: handle resize outside of handle_window_event since it updates the glutin window (the only event which does this) * main: use winit events in handle_window_event not reexported glutin events * main: refactor game loop handling into tick_all() * main: create winit window for WebGL, and use winit_window from glutin * main: restore console_error_panic_hook, mistakingly removed in (#260) * main: remove force setting env RUST_BACKTRACE=1, no longer can set env on web * www: index.js: fix wasm import path * www: npm update, npm audit fix * www: update readme to link to status on #446 🕸️ Web support
A small step for #446 🕸️ Web support, use web-sys to interface to the web. Previously, we would try to use glutin on the web, which is not supported; now glutin is only used on native: fixes #171 could not find Context in platform_impl. winit is still used on both, but the GL context is created with web-sys and glow (on the web), and created with glutin and used with glow (on native). stdweb is no longer used, being replaced by web-sys. Substantial refactoring to allow reusing the code between web/native: * settings: use VirtualKeyCode from winit, not reexported from glutin * std_or_web: remove broken localstoragefs/stdweb, add File placeholder * render: disable skin_thread on wasm since we don't have threads * gl: use glow types in gl wrapper (integers in native, but Web*Key in web) * gl: web-sys WebGlUniformLocation does not implement Copy trait, so glow::UniformLocation doesn't so gl::Uniform can't * gl: refactor context initialization, pass glow::Context to gl::init for consistency between native/web * gl: update to glow with panicking tex_image_2d_multisample web-sys wrapper * glsl: use shader version in GLSL for WebGL 2 and OpenGL 3.2 * shaders: add explicit float/int type conversions, required for WebGL * shaders: specify mediump precision, required for WebGL * shaders: specify fragment shader output locations for WebGL * main: refactor handle_window_event to take a winit window, not glutin context * main: handle resize outside of handle_window_event since it updates the glutin window (the only event which does this) * main: use winit events in handle_window_event not reexported glutin events * main: refactor game loop handling into tick_all() * main: create winit window for WebGL, and use winit_window from glutin * main: restore console_error_panic_hook, mistakingly removed in (#260) * main: remove force setting env RUST_BACKTRACE=1, no longer can set env on web * www: index.js: fix wasm import path * www: npm update, npm audit fix * www: update readme to link to status on #446 🕸️ Web support
Update to 0.22.0 alpha 5 of glutin, removing the temporary custom wasm_stub placeholder forks https://github.com/iceiix/glutin/tree/wasm_stub and https://github.com/iceiix/winit/tree/wasm_stub, for #171 and #34