Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added opengl compatibility for :meth:`~Cylinder.add_bases`.(#2039)

Ryan McCauley4c73fa235524
diff --git a/manim/mobject/three_dimensions.py b/manim/mobject/three_dimensions.py
index c34162625..c6d91998a 100644
--- a/manim/mobject/three_dimensions.py
+++ b/manim/mobject/three_dimensions.py
@@ -630,22 +630,26 @@ class Cylinder(Surface):
def add_bases(self):
"""Adds the end caps of the cylinder."""
+ color = self.color if config["renderer"] == "opengl" else self.fill_color
+ opacity = self.opacity if config["renderer"] == "opengl" else self.fill_opacity
+ u_min = self.u_range[0] if config["renderer"] == "opengl" else self.u_min
+ u_max = self.u_range[1] if config["renderer"] == "opengl" else self.u_max
self.base_top = Circle(
radius=self.radius,
- color=self.fill_color,
- fill_opacity=self.fill_opacity,
+ color=color,
+ fill_opacity=opacity,
shade_in_3d=True,
stroke_width=0,
)
- self.base_top.shift(self.u_max * IN)
+ self.base_top.shift(u_max * IN)
self.base_bottom = Circle(
radius=self.radius,
- color=self.fill_color,
- fill_opacity=self.fill_opacity,
+ color=color,
+ fill_opacity=opacity,
shade_in_3d=True,
stroke_width=0,
)
- self.base_bottom.shift(self.u_min * IN)
+ self.base_bottom.shift(u_min * IN)
self.add(self.base_top, self.base_bottom)
def _rotate_to_direction(self):