ManimCommunity / ManimCommunity/manim

Opengl unecessary runs all frames when -s flag is set

Open
#2,145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue:bug opengl
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior

When the -s flag is set it outputs the last frame of an animation. When there are no outputs such as mp4s there is no need to run each frame, it can simply skip to the last frame by setting the flag `self.renderer.skip_animations` like cairo does. We should have this logic in opengl to make these scenarios faster.

## Expected behavior

When the renderer is ONLY outputting the final frame it shouldn't calculate each frame and instead skip to the last frame.

The cairo test for this logic is:

```py
def test_t_values_save_last_frame(using_temp_config):
"""Test that there is only one t value handled when only saving the last frame"""
config.save_last_frame = True
scene = SquareToCircle()
scene.update_to_time = Mock()
scene.render()
scene.update_to_time.assert_called_once_with(1)
```

Running this with the opengl renderer means it will fail as it gets called multiple times

## How to reproduce the issue

To reproduce run the below code with the `-s` flag set. It will call `update_to_time` multiple times instead of once as the`self.renderer.skip_animations` flag is not set

Code for reproducing the problem

```py
class Test(Scene):
def construct(self):
square = Square()
circle = Circle()
self.play(Transform(square, circle))
```

## Additional media files

Images/GIFs

## Logs
Terminal output

```
PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR
```

## System specifications

System Details

- OS (with version, e.g Windows 10 v2004 or macOS 10.15 (Catalina)):
- RAM:
- Python version (`python/py/python3 --version`):
- Installed modules (provide output from `pip list`):
```
PASTE HERE
```

LaTeX details

+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:

FFMPEG

Output of `ffmpeg -version`:

```
PASTE HERE
```

## Additional comments

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

Compare the OpenGL rendering path with Cairo's handling of self.renderer.skip_animations, using test_t_values_save_last_frame as the behavioral reference. Ensure the OpenGL renderer processes only the final frame for -s, then run the corresponding test with OpenGL and confirm update_to_time is called once.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.