Closed semikernel closed 1 week ago
Hello, nice catch @semikernel!
I actually never use the OpenGL renderer, but I guess supporting it would be very easy.
Reading the OpenGLCamera
class, it looks like I might need to try from config["background_color"]
instead. Something similar might also be needed for the other attributes.
I don't have might time for this at the moment, but feel free to give it a try if you feel confident enough :-)
Hello, nice catch @semikernel!
I actually never use the OpenGL renderer, but I guess supporting it would be very easy.
Reading the
OpenGLCamera
class, it looks like I might need to try fromconfig["background_color"]
instead. Something similar might also be needed for the other attributes.I don't have might time for this at the moment, but feel free to give it a try if you feel confident enough :-)
Hi,there! I figured it out by creating a ThreeDSlideGL class, it worked. I found it difficult to integrate it to manim-slides whole project. I need to change many all = [ ] stuffs. However, it worked well:)
from manim_slides import Slide, ThreeDSlide
from manim.renderer.opengl_renderer import OpenGLCamera
class ThreeDSlideGL(ThreeDSlide):
@property
def _background_color(self) -> str:
try:
# Attempt to get the background color for OpenGLCamera
if isinstance(self.camera, OpenGLCamera):
# Check for possible attributes
if hasattr(self.camera, 'background_rgba'):
color = self.camera.background_rgba
elif hasattr(self.camera, 'background_color'):
color = self.camera.background_color
else:
# Fallback to default color if none is found
color = (0, 0, 0, 1) # Default to black
return "#" + "".join(f"{int(c*255):02x}" for c in color[:3])
else:
# Handle other camera types
color = self.camera.background_color
if hex_color := getattr(color, "hex", None):
return hex_color # type: ignore
else:
return "#000000" # Default to black if attribute is not found
except Exception as e:
# Handle any unexpected errors
return "#000000" # Default to black
Hello, nice catch @semikernel! I actually never use the OpenGL renderer, but I guess supporting it would be very easy. Reading the
OpenGLCamera
class, it looks like I might need to try fromconfig["background_color"]
instead. Something similar might also be needed for the other attributes. I don't have might time for this at the moment, but feel free to give it a try if you feel confident enough :-)Hi,there! I figured it out by creating a ThreeDSlideGL class, it worked. I found it difficult to integrate it to manim-slides whole project. I need to change many all = [ ] stuffs. However, it worked well:)
from manim_slides import Slide, ThreeDSlide from manim.renderer.opengl_renderer import OpenGLCamera class ThreeDSlideGL(ThreeDSlide): @property def _background_color(self) -> str: try: # Attempt to get the background color for OpenGLCamera if isinstance(self.camera, OpenGLCamera): # Check for possible attributes if hasattr(self.camera, 'background_rgba'): color = self.camera.background_rgba elif hasattr(self.camera, 'background_color'): color = self.camera.background_color else: # Fallback to default color if none is found color = (0, 0, 0, 1) # Default to black return "#" + "".join(f"{int(c*255):02x}" for c in color[:3]) else: # Handle other camera types color = self.camera.background_color if hex_color := getattr(color, "hex", None): return hex_color # type: ignore else: return "#000000" # Default to black if attribute is not found except Exception as e: # Handle any unexpected errors return "#000000" # Default to black
Thanks for sharing your solution, and sorry for the late reply!
The config["background_color"]
didn't work? Because, for compatibility with future versions, I would like to prefer to have the simplest solution. And, if multiple cases have to be handled, then documenting why they might exist is very important IMO :-)
Description
Hi, there! I have found that the newest V5.1.7 manim-slides can't render manim.opengl scene. The mwe is shown here:
The terminal then outputs:
Version
manim-slides, version 5.1.7
Platform
ubuntu 22.04
Screenshots
No response
Additional information
Actually in previous manim-slides, everything works well. I am wondering where the error comes from. Thx a lot:) No response