I'm getting invalid enum error
using maningl.
I have created an animated wave with video as texture.
Code works well with a short animation of around 5 seconds.
This is the result:
But with more than 10 seconds it throws invalid enum error
Animation length is controlled with method self.wait
in PinkyWaving
class.
The error:
self.construct()
File "pinky_waving.py", line 119, in construct
self.wait(10)
File "f:\instalaciones\anaconda\envs\manim2\lib\site-packages\manimlib\scene\scene.py", line 417, in wrapper
func(self, *args, **kwargs)
File "f:\instalaciones\anaconda\envs\manim2\lib\site-packages\manimlib\scene\scene.py", line 508, in wait
self.emit_frame()
File "f:\instalaciones\anaconda\envs\manim2\lib\site-packages\manimlib\scene\scene.py", line 179, in emit_frame
self.file_writer.write_frame(self.camera)
File "f:\instalaciones\anaconda\envs\manim2\lib\site-packages\manimlib\scene\scene_file_writer.py", line 238, in write_frame
raw_bytes = camera.get_raw_fbo_data()
File "f:\instalaciones\anaconda\envs\manim2\lib\site-packages\manimlib\camera\camera.py", line 294, in get_raw_fbo_data
gl.glBindFramebuffer(gl.GL_READ_FRAMEBUFFER, self.fbo_msaa.glo)
File "src/errorchecker.pyx", line 58, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError
OpenGL.error.GLError: GLError(
err = 1280,
description = b'numeraci\xf3n no v\xe1lida',
baseOperation = glBindFramebuffer,
cArguments = (GL_READ_FRAMEBUFFER, 2)
)
I'm using Python 3.8, ManimGL v1.5.0 and moderngl version: 5.7.2.
Where animation is made pinky.py
.
from manimlib import *
VIDEO_FRAMES = 'pinky_60fps-opencv'
TEXTURES = os.listdir(VIDEO_FRAMES)
N = len(TEXTURES)
FRAME_INDEX = 0
class TexturedPlaneWavingVideo(TexturedSurface):
CONFIG = {
'waving_plane_config':
{
"u_range": (-5*2,5*2),
"v_range": (-5*2,5*2),
"resolution": (32,32),
"color": BLUE_E,
"opacity": 0.85,
}
}
def __init__(self, phi=0, height_factor=1.0, d=1.0, alpha=0.1,scale_factor = 0.5, init_frame= None,**kwargs):
"""
init_frame: str
frame used as texture
"""
digest_config(self,self.CONFIG)
self.init_frame = init_frame
# Parameters
# heigth of wave
self.height_factor = height_factor
self.d = d
self.alpha = alpha
self.phi = phi
#overall scale of plane
self.scale_factor = scale_factor
# Initialize as a plane
surface = ParametricSurface(
uv_func = self.wave_func,
**self.waving_plane_config).scale(self.scale_factor)
self.surface = surface
super().__init__(uv_surface= surface,
image_file = os.path.join(VIDEO_FRAMES,self.init_frame))
def update_wave(self,dt):
self.phi += 4*dt
global FRAME_INDEX
FRAME_INDEX= (FRAME_INDEX+1)%N
texture = TEXTURES[FRAME_INDEX]
texture_path =os.path.join(VIDEO_FRAMES, TEXTURES[FRAME_INDEX])
# Create a new TexturedPlaneWavingVideo
plane = TexturedPlaneWavingVideo(
phi=self.phi, height_factor=self.height_factor, d=self.d ,alpha=self.alpha,scale_factor = self.scale_factor, init_frame=texture )
self.init_frame = texture
self.texture_paths = {
"LightTexture": get_full_raster_image_path(texture_path),
"DarkTexture": get_full_raster_image_path(texture_path),}
self.become(plane)
self.init_shader_data()
def plane_func(self,u,v):
return np.array([
u,
v,
0])
def wave_func(self, u, v):
return (u,
v,
np.sin((np.sqrt(u**2/self.d + v ** 2 / self.d) + self.phi)) * self.height_factor + self.alpha)
def wave_func_np(self,u,v):
return np.array(
[u,
v,
np.sin( (np.sqrt(u**2/self.d + v ** 2 / self.d ) + self.phi) ) * self.height_factor + self.alpha])
def waving(self,speed = 1):
"""
speed: float
speed of waving animation
"""
self.add_updater(lambda m,dt:self.update_wave(dt*speed) )
def stop_waving(self):
self.clear_updaters()
class PinkyWaving(ThreeDScene):
def construct(self):
p = TexturedPlaneWavingVideo(phi=0, height_factor=3.0, d=1.0, alpha=0.1,scale_factor = 0.5,init_frame="frame0-00-00.00.jpg")
self.play(ShowCreation(p))
p.waving()
self.wait(10)
Download an extract the images to reproduce the error: https://drive.google.com/file/d/1_kUcDP5D4-7LXi7bbpnjdobl4ajHTOMr/view?usp=sharing
Run the command manimgl pinky.py PinkyWaving -w
Each texture_path
is a path to a jpg image.
I expected to produce an animation with the full video, 2 minutes, but if the animation passes the 10 seconds it throws Invalid enum
.