ManimCommunity / ManimCommunity/manim
StreamLines Does not Work with OpenGL
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## 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.
```python
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
```py
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](https://pastebin.com/raw/WvYfqEqq)
## 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
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with mobject/opengl/opengl_mobject.py around set_data at line 294, then reproduce the supplied StreamLines example with --renderer=opengl and compare it with the cairo renderer. Trace why the OpenGL path fails when StreamLines is updated; done means the example runs under OpenGL without the local deepcopy workaround while cairo behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100