manim icon indicating copy to clipboard operation
manim copied to clipboard

StreamLines Does not Work with OpenGL

Open yang-tsao opened this issue 1 year ago • 0 comments

Description of bug / unexpected behavior

StreamLines Does not Work with OpenGL.

Expected behavior

I expected my code to work with OpenGL.

The following code works with the cairo renderer, but if I run manim with the option --renderer=opengl, I'll run into error.

How to reproduce the issue

Code for reproducing the problem

Run with the --renderer=opengl flag, the code will exit with error. Without this flag it runs smoothly.

from manim import *
import math


class GrateScene(Scene):
    def construct(self):
        Θ = ValueTracker(1)
        f = lambda _: np.asarray([math.cos(Θ.get_value()), math.sin(Θ.get_value()), 0])
        S = StreamLines(f)
        S.add_updater(lambda x: x.become((StreamLines(f))))
        self.add(S)
        self.play(Θ.animate.set_value(TAU), run_time=0.5)

If I modify the set_data function in line 294 of mobject/opengl/opengl_mobject.py to

def set_data(self, data):
    self.data = copy.deepcopy(data)
    return self

It will work under the --renderer=opengl.

Logs

Terminal output

Link of Terminal Output

System specifications

System Details
  • OS :Ubuntu 24.04 LTS, Kernel: 6.8.0-31-generic
  • RAM: 64GB
  • Python version (python/py/python3 --version):Python 3.10.14
  • Installed modules (provide output from pip list):
Package              Version
-------------------- -----------
asttokens            2.4.1
Brotli               1.1.0
build                1.2.1
CacheControl         0.14.0
certifi              2024.2.2
cffi                 1.16.0
charset-normalizer   3.3.2
cleo                 2.1.0
click                8.1.7
click-default-group  1.2.4
cloup                3.0.5
colorama             0.4.6
comm                 0.2.2
crashtest            0.4.1
cryptography         42.0.7
debugpy              1.8.1
decorator            5.1.1
distlib              0.3.8
dulwich              0.21.7
exceptiongroup       1.2.0
executing            2.0.1
fastjsonschema       2.19.1
filelock             3.14.0
future               1.0.0
glcontext            2.5.0
gprof2dot            2019.11.30
idna                 3.7
importlib_metadata   7.1.0
installer            0.7.0
ipykernel            6.29.3
ipython              8.24.0
isosurfaces          0.1.2
jaraco.classes       3.4.0
jedi                 0.19.1
jeepney              0.8.0
jupyter_client       8.6.2
jupyter_core         5.7.2
keyring              24.3.1
manim                0.18.1
ManimPango           0.5.0
mapbox-earcut        1.0.1
markdown-it-py       3.0.0
matplotlib-inline    0.1.7
mdurl                0.1.2
moderngl             5.10.0
moderngl-window      2.4.1
more-itertools       10.2.0
msgpack              1.0.8
multipledispatch     0.6.0
nest_asyncio         1.6.0
networkx             3.3
numpy                1.26.4
packaging            24.0
parso                0.8.4
pexpect              4.9.0
pickleshare          0.7.5
pillow               10.3.0
pip                  24.0
pkginfo              1.10.0
platformdirs         4.2.2
poetry               1.8.3
poetry-core          1.9.0
poetry-plugin-export 1.8.0
prompt-toolkit       3.0.42
psutil               5.9.8
ptyprocess           0.7.0
pure-eval            0.2.2
pycairo              1.26.0
pycparser            2.22
pydub                0.25.1
pyglet               1.5.16
Pygments             2.18.0
pyproject_hooks      1.1.0
pyrr                 0.10.3
PySocks              1.7.1
python-dateutil      2.9.0
PyYAML               6.0.1
pyzmq                26.0.3
rapidfuzz            3.9.1
requests             2.32.2
requests-toolbelt    1.0.0
rich                 13.7.1
scipy                1.13.1
screeninfo           0.8.1
SecretStorage        3.3.3
setuptools           70.0.0
shellingham          1.5.4
six                  1.16.0
skia-pathops         0.8.0.post1
snakeviz             2.2.0
srt                  3.5.3
stack-data           0.6.2
svgelements          1.9.6
tomli                2.0.1
tomlkit              0.12.5
tornado              6.4
tqdm                 4.66.4
traitlets            5.14.3
trove-classifiers    2024.5.22
typing_extensions    4.11.0
urllib3              2.2.1
virtualenv           20.26.2
watchdog             4.0.1
wcwidth              0.2.13
wheel                0.43.0
zipp                 3.17.0

yang-tsao avatar May 29 '24 07:05 yang-tsao