Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ChungLeeCN opened this issue Oct 27, 2024 · 0 comments
Open

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

ChungLeeCN opened this issue Oct 27, 2024 · 0 comments

Comments

@ChungLeeCN
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant