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

Resetting viewport of camera with orthographic projection results in stretching #8321

Closed
barsoosayque opened this issue Apr 7, 2023 · 0 comments · Fixed by #8323
Closed
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@barsoosayque
Copy link
Contributor

Bevy version

0.10.1

Relevant system information

`AdapterInfo { name: "NVIDIA GeForce GTX 1660", vendor: 4318, device: 8580, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "525.89.02", backend: Vulkan }`

What you did

In one system, I set camera.viewport to a custom Some(Viewport { .. }) with physical_position and physical_size (I got them from egui). After some time, in another system, I did camera.viewport = None.

What went wrong

Rendering becomes stretched, as if it would retain the same viewport size I set before resetting it, but stretching it to the whole window.

Additional information

I'm not quite sure what's wrong since I'm not very versed in rendering, but here are some key points I noticed while trying to debug this issue:

  • The same code worked on bevy 0.9;
  • I change viewport to None using a Query<&mut Camera, With<Camera3d>>::get_single_mut. If I add &mut OrthographicProjection as a second query param (and do literally nothing with it), it wouldn't stretch, but it would still render as if the viewport is the old one (the one I set to egui rect);
  • Changing window size fixes the problem.
Screenshots

Initial viewport

image

Changed viewport to fit in egui provided rectangle

image

After I set viewport to None

image

@barsoosayque barsoosayque added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Apr 7, 2023
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants