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

Fix viewer.py framebuffer size mismatch. #2055

Merged
merged 3 commits into from
Apr 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions examples/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,22 @@ def __init__(self, sim_settings: Dict[str, Any]) -> None:
)

# Compute environment camera resolution based on the number of environments to render in the window.
surface_size: tuple(int, int) = (
window_size: tuple(int, int) = (
self.sim_settings["window_width"],
self.sim_settings["window_height"],
)

configuration = self.Configuration()
configuration.title = "Habitat Sim Interactive Viewer"
configuration.size = window_size
Application.__init__(self, configuration)
self.fps: float = 60.0

# Compute environment camera resolution based on the number of environments to render in the window.
surface_size: tuple(int, int) = (
mn.gl.default_framebuffer.viewport.size()[0],
mn.gl.default_framebuffer.viewport.size()[1],
)
0mdc marked this conversation as resolved.
Show resolved Hide resolved
grid_size: tuple(int, int) = ReplayRenderer.environment_grid_size(self.num_env)
camera_resolution: tuple(int, int) = (
surface_size[0] / grid_size[0],
Expand All @@ -65,12 +77,6 @@ def __init__(self, sim_settings: Dict[str, Any]) -> None:
self.sim_settings["width"] = camera_resolution[0]
self.sim_settings["height"] = camera_resolution[1]

configuration = self.Configuration()
configuration.title = "Habitat Sim Interactive Viewer"
configuration.size = surface_size
Application.__init__(self, configuration)
self.fps: float = 60.0

# draw Bullet debug line visualizations (e.g. collision meshes)
self.debug_bullet_draw = False
# draw active contact point debug line visualizations
Expand Down