Skip to content

Examples do not work #293

Closed
Closed
@oleschum

Description

@oleschum

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy