-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add doc for migrating from wgpu.gui (#47)
- Loading branch information
1 parent
62f807a
commit 9fc9627
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# 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 builtin`canvas.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: | ||
```py | ||
from wgpu.gui.auto import WgpuCanvas, run | ||
|
||
... | ||
|
||
run() | ||
``` | ||
|
||
In rendercanvas: | ||
```py | ||
from rendercanvas.auto import RenderCanvas, loop | ||
|
||
... | ||
|
||
loop.run() | ||
``` |