-
Notifications
You must be signed in to change notification settings - Fork 4
Qt render canvas resizes before viewport rect is updated #56
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
Comments
I can indeed reproduce this. This is because the scheduler does basically this:
I the canvas is resized between asking for a draw and the actual draw taking place, the size will mismatch. This delay is generally really small, and should not affect the experience (similar to how events can happen while the draw takes place). But resize events are special, because it can cause the canvas size to mismatch. Perhaps the "resize" event should be special, possibly firing more often, and not allowing a sync handler (otherwise we cannot call it during the draw). This fits into the idea to maybe turn the In the mean time, I'd recommend simply updating the rect on each draw, right before calling |
I ran into a similar problem with imgui on glfw, see pygfx/wgpu-py#706 In short, the current system can sometimes do a draw before while not all resize events are emitted, causing a discrepancy in the size. We should solve this, but since this relates to the scheduling and async stuff, I don't want to do that right now. The approach should be that stuff that requires the physical size should query it from the canvas, so it has the up-to-date version. Code that need the logical size is probably fine, maybe things scale a bit funny during resizing a window, but I think we can live with that until we fix it properly. |
On Qt it seems like the resize event is sent only after the canvas has already resized, with
pygfx
this causes the renderer to try and draw the scene to a canvas that is smaller than expected. This does not happen on glfw or jupyter_rfb.For example if we use this example and resize the window to make it smaller we get a
GPUValidationError
:The text was updated successfully, but these errors were encountered: