ManimCommunity / ManimCommunity/manim
No zoom for opengl Camera
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
set zoom for camera doesn't work with opengl renderer
## Expected behavior
it should work
## How to reproduce the issue
> Focus on the zoom part
```py
self.set_camera_orientation(phi=70 * DEGREES, theta=-35 * DEGREES, zoom=0.72)
```
add this in the file and run with `manim --renderer opengl -ql main.py`
Code for reproducing the problem
```py
self.set_camera_orientation(phi=70 * DEGREES, theta=-35 * DEGREES, zoom=0.72)
```
## Additional media files
Images/GIFs
## Logs
Terminal output
```
~/Desktop/video
.venv ❯ manim render --renderer opengl -qh --disable_caching \
--resolution 1080,1920 --frame_rate 60 \
--format mp4 \
main.py --write_to_movie
Manim Community v0.21.0
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/himanshm/Desktop/video/.venv/lib/python3.13/site-packages/manim/cli/render/commands.py:107 │
│ in render │
│ │
│ 104 │ │ │ │ for SceneClass in scene_classes_from_file(file): │
│ 105 │ │ │ │ │ with tempconfig({}): │
│ 106 │ │ │ │ │ │ scene = SceneClass(renderer) │
│ ❱ 107 │ │ │ │ │ │ rerun = scene.render() │
│ 108 │ │ │ │ │ if rerun or config["write_all"]: │
│ 109 │ │ │ │ │ │ renderer.num_plays = 0 │
│ 110 │ │ │ │ │ │ continue │
│ │
│ /home/himanshm/Desktop/video/.venv/lib/python3.13/site-packages/manim/scene/scene.py:259 in │
│ render │
│ │
│ 256 │ │ """ │
│ 257 │ │ self.setup() │
│ 258 │ │ try: │
│ ❱ 259 │ │ │ self.construct() │
│ 260 │ │ except EndSceneEarlyException: │
│ 261 │ │ │ pass │
│ 262 │ │ except RerunSceneException: │
│ │
│ /home/himanshm/Desktop/video/main.py:44 in construct │
│ │
│ 41 │ │ ) │
│ 42 │ │ │
│ 43 │ │ # Camera (now valid because we inherit ThreeDScene) │
│ ❱ 44 │ │ self.set_camera_orientation(phi=70 * DEGREES, theta=-35 * DEGREES, zoom=0.72) │
│ 45 │ │ self.begin_ambient_camera_rotation(rate=0.06) │
│ 46 │ │ │
│ 47 │ │ nodes, edges, edge_map = self._build_graph() │
│ │
│ /home/himanshm/Desktop/video/.venv/lib/python3.13/site-packages/manim/scene/three_d_scene.py:98 │
│ in set_camera_orientation │
│ │
│ 95 │ │ if gamma is not None: │
│ 96 │ │ │ self.renderer.camera.set_gamma(gamma) │
│ 97 │ │ if zoom is not None: │
│ ❱ 98 │ │ │ self.renderer.camera.set_zoom(zoom) │
│ 99 │ │ if frame_center is not None: │
│ 100 │ │ │ self.renderer.camera._frame_center.move_to(frame_center) │
│ 101 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'OpenGLCamera' object has no attribute 'set_zoom'
```
## 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`):
```
Operating System: CachyOS Linux
KDE Plasma Version: 6.7.4
KDE Frameworks Version: 6.29.0
Qt Version: 6.11.1
Kernel Version: 7.1.8-1-cachyos (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i7-6600U CPU @ 2.60GHz
Memory: 8 GiB of RAM (7.6 GiB usable)
Graphics Processor 1: Intel® HD Graphics 520
Graphics Processor 2: AMD Radeon R7 M360
Manufacturer: Dell Inc.
Product Name: Latitude E5470
```
LaTeX details
+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:
[new.txt](https://github.com/user-attachments/files/31288711/new.txt)
## Additional comments
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 scene/three_d_scene.py at set_camera_orientation and trace the OpenGLCamera implementation implicated by the traceback. Reproduce the issue with the provided Python snippet and the --renderer opengl command. Done means the zoom argument works for the OpenGL renderer without raising AttributeError.
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
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100