Comments (6)
Good question. The GUI toolkit will indeed request a new draw when it knows that the visualization needs to be refreshed. Like when the window is resized, and om some systems when part of the window was hidden by another window and is now shown again. This was already the case before #78. What was added was the possibility for the user to request a draw. E.g. in cases that the visualization itself has changed.
This works somewhat different for Qt and glfw. In Qt the former already works automatically, and requesting a draw is done simply by calling update()
. In both cases this will at some point result in a draw event.
For glfw you have to bring your own event loop. So this draw event ... we have to do that ourselves. The simplest way I could find to realize this is by adding a single function (update_glfw_canvasses
) that you call on each iteration, and which draws any windows that have requested (manually or via e.g. a resize) to be redrawn.
In both cases, the window will not be redrawn continuously, unless you keep requesting redraws.
from wgpu-py.
Haha, now I'm not sure if I understand your question correctly :)
So, indeed Qt by itself only generates a new draw event when the window is somehow invalid (e.g. on resize). This means that our users need to call request_draw()
when the viz needs an update. The request_draw()
function for the Qt canvas simply calls .update()
.
(In theory our users could just as well call update()
, except that request_draw()
is the generic function that also works on the glfw canvas.)
from wgpu-py.
I'm wondering if we should just leave this up to the application developer by providing an API that allows them to do it.
from wgpu-py.
Nice work on the docs! The GUI API page's examples left me a little confused though; where are the calls to request_draw
?
Looking at the Qt canvas a little better, it appears that Qt is making the calls, rather than the python code. I guess my expectations were somewhat different here.
I understand that Qt will trigger a draw when the window is resized for example, or opened for the first time. Does Qt also continuously trigger drawing when there is no interaction, or does the user then need to use request_draw
to achieve that?
from wgpu-py.
Ok, great, that's perfect!
Qt the former already works automatically, and requesting a draw is done simply by calling
update()
. In both cases this will at some point result in a draw event.
Just to make sure I fully understand the details here: so Qt does not continuously call update()
when only the visualization changes? Meaning that the user needs to call request_draw()
.
from wgpu-py.
Got it! Thanks
from wgpu-py.
Related Issues (20)
- Document requirements to run in cloud/remote environments HOT 7
- Windows fatal exception: stack overflow during passing tests HOT 5
- Update wgsl compiler. HOT 4
- create_render_pipeline() fails with layout=AutoLayoutMode.auto HOT 2
- User required to specify "topology" for create_render_pipeline() HOT 2
- ERROR_OUT_OF_HOST_MEMORY with Qt on Linux/Wayland HOT 4
- Pinch and other Gestures HOT 7
- Qt screenshots and scaling HOT 7
- create_buffer_with_data requires data to be a multiple of COPY_BUFFER_ALIGNMENT HOT 11
- Would like memoryView access of a buffer that is mapped for writing. HOT 7
- Need to keep a reference to a bindgroup even if its used in a render pass HOT 12
- How to get a transparent Canvas? HOT 2
- wgpu-py requires unneeded arguments. HOT 3
- Figure out how to handle unicode char events
- Recent pull request has a bug HOT 5
- Add Windows aarch64
- Keyerror when trying to run triangle.py HOT 2
- Imgui overlay render with offscreen canvas HOT 2
- Test suite appears to be broken on github HOT 7
- Inconsistent naming of required features HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wgpu-py.