Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.15 KB

from_wgpu_canvas.md

File metadata and controls

48 lines (33 loc) · 1.15 KB

Migrating from wgpu.gui.WgpuCanvas

This project was spun out of wgpu-py, and has evolved to meet our requirements for update-propagation and more. This document lists all the changes w.r.t. the last version of the canvas in wgpu-py.

Changes

Let me know if I missed any!

  • WgpuCanvas -> RenderCanvas.
  • run -> loop.run().
  • call_later -> loop.call_later.
  • canvas.is_closed() -> canvas.get_closed().
  • The canvas.get_context() must be called with an arg: canvas.get_context("wgpu").

Improvements

  • Overall cleaner code, more tests, better docs.
  • Support for contexts other than wgpu.
  • Bitmap rendering via builtincanvas.get_context("bitmap").
  • Handling of sigint (ctrl+c).
  • Support for Trio.
  • Support for async event handlers.
  • Support for running async functions via loop.add_task().
  • Simpler Qt lib selection with from rendercanvas.pyside6 import RenderCanvas.
  • Generic scheduling system with modes "ondemand", "continious", "fastest".

By example

In wgpu-py:

from wgpu.gui.auto import WgpuCanvas, run

...

run()

In rendercanvas:

from rendercanvas.auto import RenderCanvas, loop

...

loop.run()