-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] 'OpenGLCamera' object has no attribute 'background_color' when rendering using manim.opengl #431
Comments
Hello, nice catch @semikernel! I actually never use the OpenGL renderer, but I guess supporting it would be very easy. Reading the 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 |
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
The text was updated successfully, but these errors were encountered: