Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

ndarray to buffer converter fun #14

Description

@jeromeetienne

Long/complex explanation sorry: It explains why converting why generating protocol commands with vec3 always leads to exception.


This is the ndarray to buffer converter. It is used to convert vec3/vec4 to buffer, which is required to generate GSP commands from any visual.

https://github.com/vispy/GSP/blob/6aefaab6f1386f82d8bddfe9177d89d50c6516b3/gsp/matplotlib/__init__.py#L43-L51

As it is a converter, the obj in there is a numpy.ndarray. It uses glm.ndarray.tracked(obj) which is supposed to be API compatible with np.ndarray (@rougier correct me if im wrong).

It then goes into the __new__ of https://github.com/vispy/GSP/blob/master/gsp/glm/ndarray/tracked.py.

https://github.com/vispy/GSP/blob/3fe4d22c240d91ad1a62add81258954205bde4b3/gsp/glm/ndarray/tracked.py#L36-L40

And here notice how it call np.ndarray.__new__(cls, *args, **kwargs) which is relatively equivalent to np.ndarray(obj) with the obj from the converter.

Unfortunatly np.ndarray(other_ndarray) is not a valid API. here is the doc https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html which shows that the first argument is a shape . It interprets the other_ndarray as a definition of shape and lead to this error message

Exception has occurred: ValueError
maximum supported dimension for an ndarray is currently 64, found 200000

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