Description
Issue 1: draw() function does not exist
It seems like some examples call an API of wgpu that only works for offscreen rendering.
For example, in the scatter.py example, the following line does not work:
img = np.asarray(plot.renderer.target.draw())
Instead, the correct API call would be img = np.asarray(plot.renderer.target.draw_frame())
.
Otherwise, you will get an AttributeError (for example with GLFW):
AttributeError: 'GlfwWgpuCanvas' object has no attribute 'draw'
This seems to be a relict of your automated testing, since in /examples/tests/test_examples.py, you also call the draw()
-method to obtain the image you compare with the stored screenshots. But there you probably use offscreen rendering. So you may want to fix that so that the example work not only for you CI with offscreen rendering but also for endusers who have PySide6 or GLFW.
Issue 2: 64-bit type not supported
At least on my machine (fairly old GPU, but 64bit Ubuntu 22.04), I cannot run the new scatter_size.py example. I get the error
ValueError: 64-bit float is not supported, use 32-bit floats instead
from pygfx/geometries/_base.py
. The relevant line in the scatter:size.py example is this one: non_scalar_sizes = np.abs((y_values / np.pi)) # ensure minimum size of 5
I need to add an .astype(np.float32)
and then it works.
Hope that helps.