ManimCommunity / ManimCommunity/manim

[BUG] add_updater does not work when redering with OpenGL.

Open
#3,984 0 comments 0 reactions 0 assignees View on GitHub

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
add_updater does not work when redering with OpenGL. The code runs normally under the Cairo renderer.

Code for reproducing the problem

```py
class BugReport(Scene):
def construct(self):
wave_generate = Circle(radius=0.3, color=RED_A, fill_color=BLUE, fill_opacity=0.3,
stroke_width=0.8).move_to(3 * LEFT)
Nc = 20
circle_list = [Circle(radius=0.3 + 0.8 * i, color=RED_A, stroke_width=1).move_to(3 * LEFT) for i in range(Nc)]
self.add(wave_generate, *circle_list)
self.wait(1)
self.remove(wave_generate, *circle_list)
self.start_time_for_circle = self.renderer.time

def circle_update(mob, phase):
v_factor = 1.5
current_time = self.renderer.time - self.start_time_for_circle
radius = math.fmod(0.8 * phase + v_factor * current_time, 0.8 * Nc) + 0.3
mob.set(width=2 * radius)
if radius - 0.3 <= v_factor * 1.1 / self.camera.frame_rate:
mob.set_x(wave_generate.get_x())

update_list = []
for i in range(Nc):
update_list.append(lambda mob, phase=i: circle_update(mob, phase))
(circle_list[i]).add_updater(update_list[i])
self.add(wave_generate, *circle_list)
self.wait(2)
self.play(wave_generate.animate.shift(5 * RIGHT), run_time=5, rate_func=linear)
for i in range(Nc):
(circle_list[i]).remove_updater(update_list[i])
self.wait(2)
```

Cairo:

https://github.com/user-attachments/assets/8ee0193b-66e1-4320-b4eb-c4674ac7f17f

OpenGL:

https://github.com/user-attachments/assets/f7d43e46-69f7-4037-acac-3d10c2ee41a9

## System specifications

System Details

- OS Windows 11
- RAM: 64GB
- Python version : Python 3.10

LaTeX details

+ LaTeX distribution: TeX Live 2024

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided BugReport reproduction under both the Cairo and OpenGL renderers on the listed Python and Windows setup. Compare how the add_updater callbacks affect the circles, then trace the renderer-specific update path. Done means the animation behaves consistently with Cairo when rendered with OpenGL.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.