ManimCommunity / ManimCommunity/manim
VGroup using OpenGL renderer incorrectly layers fills and strokes (macOS)
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
I recently set up Manim in a fresh virtual environment. The Cairo renderer displays this scene correctly, but the OpenGL renderer does not. In OpenGL, the fills and strokes of different Mobjects appear to be composited in the wrong order, so one object’s stroke can appear above another object’s fill.
Everything that has a VGroup with overlapping shapes renders as shown in the images below.
## Expected behavior
Fills and strokes should stay associated with the same object and respect the scene’s draw order. The OpenGL render should match the Cairo render.
Specifically in the attached image, the red triangle's outline should be visually below the purple square's fill.
## How to reproduce the issue
Any scene with overlapping shapes in a VGroup. For example, the Manim logo.
Code for reproducing the problem
```py
class Test(Scene):
def construct(self):
circle = Circle(color=GREEN, fill_opacity=1).scale(1.2)
square = Square(color=BLUE, fill_opacity=1)
self.add(square, circle)
```
```py
# Copy-pasted directly from the Manim docs:
class ManimCELogo(Scene):
def construct(self):
self.camera.background_color = "#ece6e2"
logo_green = "#87c2a5"
logo_blue = "#525893"
logo_red = "#e07a5f"
logo_black = "#343434"
ds_m = MathTex(r"\mathbb{M}", fill_color=logo_black).scale(7)
ds_m.shift(2.25 * LEFT + 1.5 * UP)
circle = Circle(color=logo_green, fill_opacity=1).shift(LEFT)
square = Square(color=logo_blue, fill_opacity=1).shift(UP)
triangle = Triangle(color=logo_red, fill_opacity=1).shift(RIGHT)
logo = VGroup(triangle, square, circle, ds_m) # order matters
logo.move_to(ORIGIN)
self.add(logo)
```
## Additional media files
Expected (Cairo) render...
```bash
manim test.py ManimCELogo -pql
```
OpenGL render (Manim logo)...
```bash
manim test.py ManimCELogo -pql --renderer opengl
```
OpenGL render (isolated)...
```bash
manim test.py Test -pql --renderer opengl
```
## Logs
Note: I've tested in both Python 3.14 and in 3.13. The logs are from 3.13 but the same image is rendered using Python3.14.
Terminal output
```bash
(.venv313) user@mac manim-code % manim test.py ManimCELogo -pql --renderer opengl -v DEBUG
Manim Community v0.20.1
2026-07-17 14:36:01.201 Python[72344:13268574] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/xk/s_5cthc14tx9jnplzlh4rkqm0000gn/T/org.python.python.savedState
[07/17/2026 14:36:01] INFO scene_file_writer.py:904
File ready at '/Users/user/Other Code/manim-code/media/images/test/ManimCELogo_ManimCE_v0.20.1.png'
INFO Rendered ManimCELogo scene.py:282
Played 0 animations
INFO Previewed File at: '/Users/user/Other Code/manim-code/media/images/test/ManimCELogo_ManimCE_v0.20.1.png' file_ops.py:236
```
## System specifications
System Details
- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): macOS 26.6 Beta (Tahoe)
- RAM: 16GB
- Apple M2
- Manim Version: Manim Community v0.20.1
- Python version (`python/py/python3 --version`): Attempted on `Python 3.13.14` and `Python 3.14.6`
- Installed modules (provide output from `pip list`):
```
(.venv313) user@mac manim-code % pip list
Package Version
----------------------- -------
asttokens 3.0.2
audioop-lts 0.2.2
av 18.0.0
beautifulsoup4 4.15.0
click 8.4.2
cloup 3.1.0
Cython 3.2.8
decorator 5.3.1
executing 2.2.1
glcontext 3.0.0
ipython 9.15.0
ipython_pygments_lexers 1.1.1
isosurfaces 0.1.2
jedi 0.20.0
manim 0.20.1
manim-interactive 0.1.0
ManimPango 0.6.1
mapbox_earcut 2.0.0
markdown-it-py 4.2.0
matplotlib-inline 0.2.2
mdurl 0.1.2
moderngl 5.12.0
moderngl-window 3.1.1
networkx 3.6.1
numpy 2.5.1
parso 0.8.7
pexpect 4.9.0
pillow 12.3.0
pip 26.1.2
prompt_toolkit 3.0.52
psutil 7.2.2
ptyprocess 0.7.0
pure_eval 0.2.3
pycairo 1.29.0
pydub 0.25.1
pyglet 2.1.15
pyglm 2.8.3
Pygments 2.20.0
pyobjc-core 12.2.1
pyobjc-framework-Cocoa 12.2.1
pyperclip 1.11.0
rich 15.0.0
scipy 1.18.0
screeninfo 0.8.1
setuptools 83.0.0
skia-pathops 0.9.2
soupsieve 2.8.4
srt 3.5.3
stack-data 0.6.3
svgelements 1.9.6
tqdm 4.69.0
traitlets 5.15.1
typing_extensions 4.16.0
watchdog 6.0.0
wcwidth 0.8.2
(.venv313) user@mac manim-code % pip list --not-required
Package Version
----------------- -------
manim-interactive 0.1.0
pip 26.1.2
setuptools 83.0.0
```
LaTeX details
Bug reproduces without any LaTeX objects, so LaTeX is likely unrelated.
+ LaTeX distribution (e.g. TeX Live 2020): BasicTeX (TeX Live)
+ Installed LaTeX packages: standalone, preview, dvisvgm, plus many dependencies.
## Additional comments
This was reproduced in a clean virtual environment. I also tested Python 3.13.14 and 3.14.6 with the same result.
I'm unsure why the OpenGL render has a black background, possibly related?
Contributor guide
Research direction
Start by running the Test and ManimCELogo examples with Cairo and with `--renderer opengl`, comparing the VGroup draw order and background. Trace the OpenGL rendering path from the scene entry points shown in the examples and use the `scene.py` render logs as a reference. Done means overlapping fills and strokes respect VGroup order and the OpenGL result matches Cairo.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100