manim icon indicating copy to clipboard operation
manim copied to clipboard

glBindFramebuffer raise GLError 1280

Open INFO-studio opened this issue 2 years ago • 8 comments

Describe the error

When i run manimgl xxx.py xxx everything is good and when there's only code self.wait() and run manimgl xxx.py xxx -w it will be fine too, but when my code add some mobject in the output screen and run manimgl xxx.py xxx -w or manimgl xxx.py xxx -o, it raise GLError 1280

Code and Error

Code:

from manimlib import *

class S1(Scene):
    def construct(self):
        c = Circle()
        self.wait()
        self.add(c) # error

when i remove the error code and it will run perfectly(but i can't do nothing)

Error:

  File "/Library/Frameworks/Python.framework/Versions/3.11/bin/manimgl", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/__main__.py", line 22, in main
    scenes = manimlib.extract_scene.main(config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/extract_scene.py", line 140, in main
    scenes = get_scenes_to_render(all_scene_classes, scene_config, config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/extract_scene.py", line 103, in get_scenes_to_render
    fw_config["total_frames"] = compute_total_frames(scene_class, scene_config)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/extract_scene.py", line 87, in compute_total_frames
    pre_scene.run()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/scene/scene.py", line 94, in run
    self.tear_down()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/scene/scene.py", line 111, in tear_down
    self.file_writer.finish()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/scene/scene_file_writer.py", line 195, in finish
    self.save_final_image(self.scene.get_image())
                          ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/scene/scene.py", line 164, in get_image
    return self.camera.get_image()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/camera/camera.py", line 277, in get_image
    self.get_raw_fbo_data(),
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/camera/camera.py", line 264, in get_raw_fbo_data
    gl.glBindFramebuffer(gl.GL_READ_FRAMEBUFFER, self.fbo_msaa.glo)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/OpenGL/platform/baseplatform.py", line 415, in __call__
    return self( *args, **named )
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/OpenGL/error.py", line 230, in glCheckError
    raise self._errorClass(
OpenGL.error.GLError: GLError(
	err = 1280,
	description = b'invalid enumerant',
	baseOperation = glBindFramebuffer,
	cArguments = (GL_READ_FRAMEBUFFER, 3)
)

Environment

OS System: MacOS Sonoma 14.1.1

INFO-studio avatar Nov 30 '23 14:11 INFO-studio

Well, I found out what the problem is, just add a line gl.glGetError() to function get_raw_fbo_data in file /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/manimlib/camera/camera.py and it will be solved. 图片 (File locations may change depending on the system environment)

INFO-studio avatar Dec 02 '23 10:12 INFO-studio

It still doesn't work. I tried doing this and it works when i pass argument -w but normally it doesn't. Screenshot 2023-12-22 at 7 36 13 PM

Shekhar-Dangi avatar Dec 22 '23 14:12 Shekhar-Dangi

It still doesn't work. I tried doing this and it works when i pass argument -w but normally it doesn't. Screenshot 2023-12-22 at 7 36 13 PM

Please show me as many error messages as possible when you try to rendering normally, that can help to determine where to modify the program.

INFO-studio avatar Dec 24 '23 01:12 INFO-studio

Yeah, this is what I got :

Screenshot_2023-12-22_at_7 07 27_PM

Shekhar-Dangi avatar Dec 25 '23 14:12 Shekhar-Dangi

Yeah, this is what I got : Screenshot_2023-12-22_at_7 07 27_PM

In the error messages, you can find which file and which line raised this error from the bottom to the top, just add gl.glGetError() before this line. And if that won't work, try another error message until it will. XD

INFO-studio avatar Dec 25 '23 14:12 INFO-studio

@INFO-studio Thanks a lot.

Shekhar-Dangi avatar Dec 27 '23 10:12 Shekhar-Dangi

@INFO-studio seems that it works for me, could you help explain why this can fix the issue? Since it is just get the last error from OpenGL

mantis7 avatar Jan 11 '24 02:01 mantis7

@INFO-studio seems that it works for me, could you help explain why this can fix the issue? Since it is just get the last error from OpenGL

Well, I guess that's just because some non-fatal errors happened, which I didn't find why. OpenGL can just draw it and continue working, but when the code start to clear the cache and prepare to write the next frame, the error was still in the todo queue and OpenGL will stop the script and draw error. That's also why it can work in preview mode(because that needn't to clear the cache).

INFO-studio avatar Jan 11 '24 14:01 INFO-studio