[BUG] add_updater does not work when redering with OpenGL.
Opened this issue · 0 comments
ChungLeeCN commented
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
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:
BugReport_Cairo.mp4
OpenGL:
BugReport_OpenGL.mp4
System specifications
System Details
- OS Windows 11
- RAM: 64GB
- Python version : Python 3.10
LaTeX details
- LaTeX distribution: TeX Live 2024