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

resize GL context on window size change #204

Merged
merged 1 commit into from
Oct 11, 2021

Conversation

w-flo
Copy link
Contributor

@w-flo w-flo commented Oct 11, 2021

Edit: Ugh, I have never compiled for wasm to be honest, and I haven't noticed that wasm example directory. If this change is fine otherwise, I'll update this to fix the example code obviously.

This might be problematic because it changes the public API of the renderer in a pretty prominent place. Since the renderer doesn't have easy access to the glutin context (as far as I can tell), this was the best I could come up with, other than possible workarounds like "set a dirty flag in the renderer, then resize the context on next render_and_swap_buffers() call where the context is passed in". Let me know if you prefer that solution. :-)

Both input and "windowing" seem to work pretty well on Wayland Gnome for me with that change. The window decoration appears to be rather "simple" but that's okay.


This is an API-breaking change for anyone not using the Framework
helper. Instead of calling the set_frame_size() method on the
Renderer after a window size change, it is now necessary to call the
set_frame_size() method on the Engine. Framework was updated to
handle this correctly.

Explicitly changing the GL context size (backbuffer) after window resize
events happens automatically on most platforms, but is needed for
Wayland and macOS according to glutin docs.

This fixes an issue on Wayland, where the window content size did not
change after a window resize, only the window title bar.

Might help for issues #167 and #10.

This is an API-breaking change for anyone not using the `Framework`
helper. Instead of calling the `set_frame_size()` method on the
`Renderer` after a window size change, it is now necessary to call the
`set_frame_size()` method on the `Engine`. `Framework` was updated to
handle this correctly.

Explicitly changing the GL context size (backbuffer) after window resize
events happens automatically on most platforms, but is needed for
Wayland and macOS according to glutin docs.

This fixes an issue on Wayland, where the window content size did not
change after a window resize, only the window title bar.

Might help for issues FyroxEngine#167 and FyroxEngine#10.
@mrDIMAS
Copy link
Member

mrDIMAS commented Oct 11, 2021

Looks good to me, thanks for the PR!

@mrDIMAS mrDIMAS merged commit c670592 into FyroxEngine:master Oct 11, 2021
@w-flo
Copy link
Contributor Author

w-flo commented Oct 11, 2021

Sorry, I should have sent a new comment instead of editing the PR text only, so that you would see it!

I noticed in the github CI results that I missed the wasm examples, they still use the renderer.set_frame_size() method that is now private to the crate. So the wasm build is failing now apparently.

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 this pull request may close these issues.

2 participants