Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Running egui_dock.rs example failed. #195

Open
gloridifice opened this issue Apr 12, 2024 · 1 comment
Open

Running egui_dock.rs example failed. #195

gloridifice opened this issue Apr 12, 2024 · 1 comment

Comments

@gloridifice
Copy link

Caused by:
    In a RenderPass
      note: encoder = `main_opaque_pass_3d_command_encoder`
    In a set_viewport command
    Viewport has invalid rect Rect { x: 1501.0, y: 48.0, w: 5998.0, h: 7951.0 }; origin and/or size is less than or equal to 0, and/or is not contained in the render target (2560, 1440, 1)

Log:
https://gist.github.com/gloridifice/088ce7de2c1502ccf86dd8bd9691b0c4

@SuddenlyHazel
Copy link

Seeing this happen as well. I'm not exactly sure the root cause. But, my best guess as of now is that

ui_state.viewport_rect.size()

is producing some absurd size on the first call. I'm not familiar enough with the codebase to provide more thoughts 🤔 .

If you modify you code as follows it'll at least get you working again:

if viewport_size.x > window.resolution.physical_width() as f32
    || viewport_size.y > window.resolution.physical_height() as f32
{
    return;
}

cam.viewport = Some(bevy::render::camera::Viewport {
    physical_position: UVec2::new(viewport_pos.x as u32, viewport_pos.y as u32),
    physical_size: UVec2::new( viewport_size.x as u32,  viewport_size.y as u32),
    depth: 0.0..1.0,
});

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants