From d7d2db588578af478a821f7b708ff3748ef1209d Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Tue, 17 Sep 2024 16:06:34 +0200 Subject: [PATCH] minor tweaks --- wgpu/gui/base.py | 12 +++++------- wgpu/gui/glfw.py | 5 +++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/wgpu/gui/base.py b/wgpu/gui/base.py index beb2b68e..400dfb57 100644 --- a/wgpu/gui/base.py +++ b/wgpu/gui/base.py @@ -11,10 +11,8 @@ def create_canvas_context(canvas): raise RuntimeError( "A backend must be selected (e.g. with request_adapter()) before canvas.get_context() can be called." ) - # Instantiate the context - CC = sys.modules[backend_module].GPUCanvasContext # noqa: N806 - # CC = sys.modules["wgpu"]._classes.GPUCanvasContext - return CC(canvas) + CanvasContext = sys.modules[backend_module].GPUCanvasContext # noqa: N806 + return CanvasContext(canvas) class WgpuCanvasInterface: @@ -34,9 +32,9 @@ def __init__(self, *args, **kwargs): def get_surface_info(self): """Get information about the surface to render to. - The result is a small dict, by which the context determines how the - rendered image is presented to the canvas. There are two possible - methods. + The result is a small dict, used by the canvas-context to determine how + the rendered result should be presented to the canvas. There are two + possible methods. If the ``method`` field is "screen", the context will render directly to a surface representing the region on the screen. The dict should diff --git a/wgpu/gui/glfw.py b/wgpu/gui/glfw.py index ec74cd7d..725c9fa8 100644 --- a/wgpu/gui/glfw.py +++ b/wgpu/gui/glfw.py @@ -519,8 +519,9 @@ def _on_char(self, window, char): def present_image(self, image, **kwargs): raise NotImplementedError() - # glfw does not have a way to blit an image. - # We could use OpenGL to display it though. + # AFAIK glfw does not have a builtin way to blit an image. It also does + # not really need one, since it's the most reliable GUI backend to + # render to the screen. # Make available under a name that is the same for all gui backends