Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocking render call #471

Open
Korijn opened this issue Mar 3, 2024 · 2 comments
Open

Blocking render call #471

Korijn opened this issue Mar 3, 2024 · 2 comments

Comments

@Korijn
Copy link
Collaborator

Korijn commented Mar 3, 2024

Make it possible to render a new frame synchronously; in other words, a public API to call canvas._draw_frame_and_present directly. Do we have this?

Relates to pygfx/pygfx#667

@almarklein
Copy link
Collaborator

almarklein commented Mar 4, 2024

We don't have this for normal canvases, but the offscreen canvas does exactly that:

def draw(self):
"""Perform a draw and get the resulting image.
The image array is returned as an NxMx4 memoryview object.
This object can be converted to a numpy array (without copying data)
using ``np.asarray(arr)``.
"""
return self._draw_frame_and_present()

Users could use the private canvas._draw_frame_and_present for now. I'm a little worried, if we make this a public method, how this affects e.g. async code, once we implement that.

@almarklein
Copy link
Collaborator

Relates to #391

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants