Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 2 additions & 5 deletions examples/imgui_backend_sea.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,8 @@ def gui(app_state):
# init imgui backend
imgui.create_context()
imgui_backend = ImguiWgpuBackend(device, render_texture_format)
imgui_backend.io.display_size = canvas.get_logical_size()
imgui_backend.io.display_framebuffer_scale = (
canvas.get_pixel_ratio(),
canvas.get_pixel_ratio(),
)
imgui_backend.io.display_size = present_context.logical_size
imgui_backend.io.display_framebuffer_scale = (present_context.pixel_ratio,) * 2


# register event handlers
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ tests = [
"imageio",
"anyio",
"trio",
"rendercanvas",
"rendercanvas>=2.4.0",
]
examples = ["pypng", "rendercanvas", "glfw"]
docs = ["sphinx>7.2", "sphinx_rtd_theme"]
Expand Down
8 changes: 4 additions & 4 deletions wgpu/utils/imgui/imgui_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def __init__(self, device, canvas, render_target_format=None):

self._backend = ImguiWgpuBackend(device, render_target_format)

self._backend.io.display_size = canvas.get_logical_size()
scale = canvas.get_pixel_ratio()
self._backend.io.display_size = self._canvas_context.logical_size
scale = self._canvas_context.pixel_ratio
self._backend.io.display_framebuffer_scale = (scale, scale)

canvas.add_event_handler(self._on_resize, "resize")
Expand Down Expand Up @@ -144,8 +144,8 @@ def render(self):

imgui.set_current_context(self.imgui_context)

pixel_ratio = self._canvas_context.canvas.get_pixel_ratio()
lsize = self._canvas_context.canvas.get_logical_size()
pixel_ratio = self._canvas_context.pixel_ratio
lsize = self._canvas_context.logical_size
self._backend.io.display_framebuffer_scale = (pixel_ratio, pixel_ratio)
self._backend.io.display_size = lsize

Expand Down
Loading