Switch from .run_forever() to .poll_events() in gfx_app #1822
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit uses
.poll_events()
to allow processing multiple events per rendered frame. (Before, only one event was processed per frame.) This is necessary because it's easy for the user to generate events much faster than frames can be rendered (e.g. by moving the mouse).Additionally, with
.run_forever()
, rendering blocked on receiving events. (An event had to occur before a frame was rendered.) In order to see an animation such as theparticle
example, the user had to generate events fast enough to cause frames to be rendered (e.g. by moving the mouse over the window).See also rust-windowing/winit#276 and rust-windowing/winit#231
PR checklist:
make
succeeds (on *nix)I don't see a Makefile.
make
saysmake: *** No targets specified and no makefile found. Stop.
make reftests
succeedsI don't see a Makefile. I did run
cargo test
, though, and that succeeded (although it ran only 3 tests).When I run
glxinfo
, I seeOpenGL core profile version string: 3.3 (Core Profile) Mesa 17.3.3
. I tested all of the examples. They all worked correctly, exceptterrain_tessellated
(which failed to build even before this commit) andtriangle
(which still has the.run_forever()
issue since it doesn't usegfx_app
).