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

Event processing blocks during window resizing #408

Closed
zhanggyb opened this issue Jan 4, 2015 · 5 comments
Closed

Event processing blocks during window resizing #408

zhanggyb opened this issue Jan 4, 2015 · 5 comments
Assignees
Labels
macOS support Windows Win32 specific (not Cygwin or WSL)
Milestone

Comments

@zhanggyb
Copy link

zhanggyb commented Jan 4, 2015

Hello, I'm not sure this is a bug in GLFW, and this issue exists in GLFW 3.0.4 and the latest 3.1 master:

Does anyone notice that in OSX, the OpenGL Context is not rendered (partially or totally) when resizing the window, just as shown in the screenshots below:

resize_window_bug1

resize_window_bug2

There's no such issue in Linux build.

@slimsag
Copy link
Contributor

slimsag commented Jan 4, 2015

I get the same behavior (no rendering during resize) on Windows as well.

@elmindreda
Copy link
Member

See the window refresh callback.

@elmindreda elmindreda added macOS question Please use the support label instead labels Jan 4, 2015
@elmindreda elmindreda self-assigned this Jan 4, 2015
@dmitshur
Copy link
Collaborator

dmitshur commented Jan 4, 2015

Does anyone notice that in OSX, the OpenGL Context is not rendered (partially or totally) when resizing the window, just as shown in the screenshots

Yes, that's the usual behavior. It happens when you have a typical simple for { render; window.SwapBuffers(); glfw.PollEvents(); } main loop. For example, you can see that behavior if you try the Gears app in examples folder.

I forgot about it, but as @elmindreda pointed out, the window refresh callback can be used to improve the behavior.

I just played with it, and my understanding of what happens (please correct if inaccurate) is this:

  • When resizing the window on OS X, glfw.PollEvents() blocks and does not return until user releases mouse button to stop resizing.
  • In a typical for loop as shown above, that means rendering and swapping buffers stops to occur.
  • However, you can (is this correct?) perform rendering and swap buffer, but not poll events (is this correct?) in the refresh callback, which is called while execution is inside poll events.

I've tested it out with a simple gl.Clear(gl.COLOR_BUFFER_BIT) and window.SwapBuffers() inside the refresh callback and it worked as expected to improve the resizing behavior.

@elmindreda
Copy link
Member

Yes, it's perfectly fine to call glfwSwapBuffers from a callback, or from another thread if you are rendering there, and either method will fix this issue.

@elmindreda elmindreda changed the title The OpenGL Context is not rendered when resizing window in OS X 10.10.1 Event processing blocks during window resizing Jan 4, 2015
@elmindreda elmindreda added the Windows Win32 specific (not Cygwin or WSL) label Jan 4, 2015
@zhanggyb
Copy link
Author

zhanggyb commented Jan 5, 2015

OK, I understand now. Thanks!

@zhanggyb zhanggyb closed this as completed Jan 5, 2015
@elmindreda elmindreda added this to the milestone Jan 5, 2015
@elmindreda elmindreda added the duplicate Issues duplicating another issue label Jan 15, 2015
@elmindreda elmindreda modified the milestone: Feb 25, 2015
@elmindreda elmindreda added support and removed duplicate Issues duplicating another issue question Please use the support label instead labels Oct 26, 2017
kairenw pushed a commit to ouster-lidar/ouster_example that referenced this issue Apr 20, 2021
* FLEETSW-3173: resizing viz causes incorrect display on macos
* FLEETSW-3174: relative paths fail for pcap replay on macos

The resizing bug is due to how polling for events works on macos,
explained here: glfw/glfw#408. This adds extra
rendering updates inside the window resize callback, as suggested in the
thread.

The relative path bug was, surprisingly also due to some weird glfw3
behavior: only on macos, initializing the library changes the working
directory. This adds an init hint to prevent that behavior.

Approved-by: Kairen Wong
Approved-by: Chris Bayruns
dmitrig pushed a commit to ouster-lidar/ouster_example that referenced this issue Jun 8, 2021
* FLEETSW-3173: resizing viz causes incorrect display on macos
* FLEETSW-3174: relative paths fail for pcap replay on macos

The resizing bug is due to how polling for events works on macos,
explained here: glfw/glfw#408. This adds extra
rendering updates inside the window resize callback, as suggested in the
thread.

The relative path bug was, surprisingly also due to some weird glfw3
behavior: only on macos, initializing the library changes the working
directory. This adds an init hint to prevent that behavior.

Approved-by: Kairen Wong
Approved-by: Chris Bayruns
kairenw pushed a commit to ouster-lidar/ouster_example that referenced this issue Aug 23, 2022
* FLEETSW-3173: resizing viz causes incorrect display on macos
* FLEETSW-3174: relative paths fail for pcap replay on macos

The resizing bug is due to how polling for events works on macos,
explained here: glfw/glfw#408. This adds extra
rendering updates inside the window resize callback, as suggested in the
thread.

The relative path bug was, surprisingly also due to some weird glfw3
behavior: only on macos, initializing the library changes the working
directory. This adds an init hint to prevent that behavior.

Approved-by: Kairen Wong
Approved-by: Chris Bayruns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS support Windows Win32 specific (not Cygwin or WSL)
Projects
None yet
Development

No branches or pull requests

4 participants