From 3ccf8a703a98ca0afb163ac7ab21bdb03b9a55cb Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Tue, 10 Dec 2024 13:19:16 +0100 Subject: [PATCH 1/2] Fix rendering via bitmap adapter --- examples/noise.py | 2 +- rendercanvas/utils/bitmappresentadapter.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/noise.py b/examples/noise.py index e97df57..8b4870e 100644 --- a/examples/noise.py +++ b/examples/noise.py @@ -8,7 +8,7 @@ # run_example = true import numpy as np -from rendercanvas.auto import RenderCanvas, loop +from rendercanvas.pyside6 import RenderCanvas, loop canvas = RenderCanvas(update_mode="continuous") diff --git a/rendercanvas/utils/bitmappresentadapter.py b/rendercanvas/utils/bitmappresentadapter.py index 3275906..12704e1 100644 --- a/rendercanvas/utils/bitmappresentadapter.py +++ b/rendercanvas/utils/bitmappresentadapter.py @@ -36,7 +36,8 @@ def present_bitmap(self, bitmap): self._texture_helper.set_texture_data(bitmap) if not self._context_is_configured: - self._context.configure(device=self._device, format="rgba8unorm") + format = self._context.get_preferred_format(self._device.adapter) + self._context.configure(device=self._device, format=format) target = self._context.get_current_texture().create_view() command_encoder = self._device.create_command_encoder() From d368efac4809a2b1218573634eb247e97f82cc11 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Tue, 10 Dec 2024 13:20:57 +0100 Subject: [PATCH 2/2] restore --- examples/noise.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/noise.py b/examples/noise.py index 8b4870e..e97df57 100644 --- a/examples/noise.py +++ b/examples/noise.py @@ -8,7 +8,7 @@ # run_example = true import numpy as np -from rendercanvas.pyside6 import RenderCanvas, loop +from rendercanvas.auto import RenderCanvas, loop canvas = RenderCanvas(update_mode="continuous")