Skip to content
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

OpenGL.error.GLError: GLError(err = 1282, description = b'invalid operation', baseOperation = glBindFramebuffer, cArguments = (GL_DRAW_FRAMEBUFFER, 0) ) #11

Open
sarmadgulzar opened this issue Dec 19, 2024 · 29 comments

Comments

@sarmadgulzar
Copy link

Device: Apple MacBook Pro
Processor: M1 Pro
RAM: 16GB
Python: 3.10.16

Running this code:

import argparse

import genesis as gs


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-v", "--vis", action="store_true", default=False)
    args = parser.parse_args()

    ########################## init ##########################
    gs.init(backend=gs.cpu)

    ########################## create a scene ##########################

    scene = gs.Scene(
        sim_options=gs.options.SimOptions(),
        viewer_options=gs.options.ViewerOptions(
            camera_pos=(3.5, 0.0, 2.5),
            camera_lookat=(0.0, 0.0, 0.5),
            camera_fov=40,
        ),
        show_viewer=args.vis,
        rigid_options=gs.options.RigidOptions(
            dt=0.01,
            gravity=(0.0, 0.0, -10.0),
        ),
    )

    ########################## entities ##########################
    plane = scene.add_entity(gs.morphs.Plane())
    r0 = scene.add_entity(
        gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"),
    )

    ########################## build ##########################
    scene.build()

    gs.tools.run_in_another_thread(fn=run_sim, args=(scene, args.vis))
    if args.vis:
        scene.viewer.start()


def run_sim(scene, enable_vis):
    from time import time

    t_prev = time()
    i = 0
    while True:
        i += 1

        scene.step()

        t_now = time()
        print(1 / (t_now - t_prev), "FPS")
        t_prev = t_now
        if i > 200:
            break

    if enable_vis:
        scene.viewer.stop()


if __name__ == "__main__":
    main()

Gives this error:

(venv) genesis-tests $ python render_on_macos.py -v
objc[15853]: Class GLFWHelper is implemented in both /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-darwin.so (0x153e00570) and /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/pygel3d/libPyGEL.dylib (0x318b5d7c0). One of the two will be used. Which one is undefined.
objc[15853]: Class GLFWApplicationDelegate is implemented in both /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-darwin.so (0x153e005c0) and /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/pygel3d/libPyGEL.dylib (0x318b5d810). One of the two will be used. Which one is undefined.
objc[15853]: Class GLFWWindowDelegate is implemented in both /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-darwin.so (0x153e005e8) and /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/pygel3d/libPyGEL.dylib (0x318b5d838). One of the two will be used. Which one is undefined.
objc[15853]: Class GLFWContentView is implemented in both /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-darwin.so (0x153e00638) and /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/pygel3d/libPyGEL.dylib (0x318b5d888). One of the two will be used. Which one is undefined.
objc[15853]: Class GLFWWindow is implemented in both /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-darwin.so (0x153e006b0) and /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/pygel3d/libPyGEL.dylib (0x318b5d900). One of the two will be used. Which one is undefined.
[Genesis] [07:29:41] [INFO] ╭───────────────────────────────────────────────────╮
[Genesis] [07:29:41] [INFO] │┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈ Genesis ┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈│
[Genesis] [07:29:41] [INFO] ╰───────────────────────────────────────────────────╯
[Genesis] [07:29:41] [INFO] Running on [Apple M1 Pro] with backend gs.cpu. Device memory: 16.00 GB.
[Genesis] [07:29:41] [INFO] 🚀 Genesis initialized. 🔖 version: 0.2.0, 🌱 seed: None, 📏 precision: '32', 🐛 debug: False, 🎨 theme: 'dark'.
[Genesis] [07:29:41] [INFO] Scene <b7b3450> created.
[Genesis] [07:29:41] [INFO] Adding <gs.RigidEntity>. idx: 0, uid: <f805cf5>, morph: <gs.morphs.Plane>, material: <gs.materials.Rigid>.
[Genesis] [07:29:41] [INFO] Adding <gs.RigidEntity>. idx: 1, uid: <8e1952d>, morph: <gs.morphs.MJCF(file='/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/genesis/assets/xml/franka_emika_panda/panda.xml')>, material: <gs.materials.Rigid>.
[Genesis] [07:29:42] [INFO] Building scene <b7b3450>...
[Genesis] [07:29:45] [INFO] Compiling simulation kernels...
[Genesis] [07:29:50] [INFO] Building visualizer...
[Genesis] [07:29:51] [WARNING] Non-linux system detected. In order to use the interactive viewer, you need to manually run simulation in a separate thread and then start viewer. See `examples/render_on_macos.py`.
[Genesis] [07:29:51] [INFO] Viewer created. Resolution: 644×483, max_FPS: 60.
[Genesis] [07:29:51] [INFO] Running at 4403.59 FPS.
212.07989078222178 FPS
[Genesis] [07:29:51] [INFO] Running at 817.58 FPS.
49.25956287361856 FPS
[Genesis] [07:29:51] [INFO] Running at 458.47 FPS.
48.77040964639946 FPS
[Genesis] [07:29:51] [INFO] Running at 134.71 FPS.
9.257559571631631 FPS
[Genesis] [07:29:51] [INFO] Running at 124.58 FPS.
50.796948044083805 FPS
[Genesis] [07:29:51] [INFO] Running at 115.89 FPS.
49.56927258760267 FPS
[Genesis] [07:29:51] [INFO] Running at 108.51 FPS.
48.815819182737634 FPS
2024-12-19 07:29:51.457 Python[15853:4047441] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/2q/0h01c5_n6_1g4xw0phb_c_3r0000gn/T/org.python.python.savedState
[Genesis] [07:29:51] [INFO] Running at 102.29 FPS.
48.57667006393032 FPS
[Genesis] [07:29:51] [INFO] Running at 97.05 FPS.
48.85676012533634 FPS
[Genesis] [07:29:51] [INFO] Running at 90.32 FPS.
31.28326682826776 FPS
uniform not found: V
uniform not found: P
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: V
uniform not found: P
uniform not found: M
uniform not found: V
uniform not found: P
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: M
uniform not found: ambient_light
uniform not found: directional_lights[0].color
uniform not found: directional_lights[0].direction
uniform not found: directional_lights[0].intensity
uniform not found: directional_lights[0].shadow_map
uniform not found: directional_lights[0].light_matrix
uniform not found: n_directional_lights
uniform not found: n_spot_lights
uniform not found: n_point_lights
uniform not found: point_lights[0].shadow_map
uniform not found: point_lights[1].shadow_map
uniform not found: point_lights[2].shadow_map
uniform not found: point_lights[3].shadow_map
uniform not found: cam_pos
uniform not found: reflection_mat
uniform not found: V
uniform not found: P
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: ambient_light
uniform not found: directional_lights[0].color
uniform not found: directional_lights[0].direction
uniform not found: directional_lights[0].intensity
uniform not found: directional_lights[0].shadow_map
uniform not found: directional_lights[0].light_matrix
uniform not found: n_directional_lights
uniform not found: n_spot_lights
uniform not found: n_point_lights
uniform not found: point_lights[0].shadow_map
uniform not found: point_lights[1].shadow_map
uniform not found: point_lights[2].shadow_map
uniform not found: point_lights[3].shadow_map
uniform not found: cam_pos
uniform not found: reflection_mat
uniform not found: V
uniform not found: P
uniform not found: M
uniform not found: material.base_color_texture
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: ambient_light
uniform not found: directional_lights[0].color
uniform not found: directional_lights[0].direction
uniform not found: directional_lights[0].intensity
uniform not found: directional_lights[0].shadow_map
uniform not found: directional_lights[0].light_matrix
uniform not found: n_directional_lights
uniform not found: n_spot_lights
uniform not found: n_point_lights
uniform not found: point_lights[0].shadow_map
uniform not found: point_lights[1].shadow_map
uniform not found: point_lights[2].shadow_map
uniform not found: point_lights[3].shadow_map
uniform not found: cam_pos
uniform not found: reflection_mat
uniform not found: V
uniform not found: P
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
uniform not found: M
uniform not found: material.base_color_factor
uniform not found: material.metallic_factor
uniform not found: material.roughness_factor
uniform not found: material.emissive_factor
Traceback (most recent call last):
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/render_on_macos.py", line 65, in <module>
    main()
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/render_on_macos.py", line 41, in main
    scene.viewer.start()
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/genesis/vis/viewer.py", line 91, in start
    self._pyrender_viewer.start()
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/genesis/ext/pyrender/viewer.py", line 386, in start
    self._init_and_start_app()
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/genesis/ext/pyrender/viewer.py", line 1149, in _init_and_start_app
    pyglet.clock.tick()
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/pyglet/clock.py", line 528, in tick
    return _default.tick(poll)
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/pyglet/clock.py", line 270, in tick
    self.call_scheduled_functions(delta_t)
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/pyglet/clock.py", line 217, in call_scheduled_functions
    item.func(now - item.last_ts, *item.args, **item.kwargs)
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/genesis/ext/pyrender/viewer.py", line 941, in _time_event
    self.on_draw()
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/genesis/ext/pyrender/viewer.py", line 654, in on_draw
    self._renderer.render_texts(
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/genesis/ext/pyrender/renderer.py", line 258, in render_texts
    self._configure_forward_pass_viewport(0)
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/genesis/ext/pyrender/renderer.py", line 1160, in _configure_forward_pass_viewport
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)
  File "/Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/OpenGL/error.py", line 230, in glCheckError
    raise self._errorClass(
OpenGL.error.GLError: GLError(
        err = 1282,
        description = b'invalid operation',
        baseOperation = glBindFramebuffer,
        cArguments = (GL_DRAW_FRAMEBUFFER, 0)
)
@YutoYasunaga
Copy link

I have same problem with MacBook Pro M1 too.

@YutoYasunaga
Copy link

Resolved by adding PYOPENGL_PLATFORM=egl

But now I have issue #32

@RobRoyce
Copy link
Contributor

Works for me after:

  • Install ffmpeg using brew install ffmpeg
  • Upgrade PyOpenGL with pip install -U PyOpenGL
  • Remove pygel3d with pip uninstall pygel3d (that will get rid of the warnings you get when first launching)

@CommanderCrowCode
Copy link

Works for me after:

  • Install ffmpeg using brew install ffmpeg
  • Upgrade PyOpenGL with pip install -U PyOpenGL
  • Remove pygel3d with pip uninstall pygel3d (that will get rid of the warnings you get when first launching)

Still doesn't work for me. I have done the above.

❯ ffmpeg -version | head -n 1
ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
❯ uv pip list | grep -E "pyopengl | gel3d"
pyopengl               3.1.7
❯ .venv/bin/python render_on_macos.py --vis

Still got GLError

OpenGL.error.GLError: GLError(
	err = 1282,
	description = b'invalid operation',
	baseOperation = glBindFramebuffer,
	cArguments = (GL_DRAW_FRAMEBUFFER, 0)
)

@zeng-yifei
Copy link

me too, still get this error on mac:
OpenGL.error.GLError: GLError(
err = 1282,
description = b'invalid operation',
baseOperation = glBindFramebuffer,
cArguments = (GL_DRAW_FRAMEBUFFER, 0)
)

@zhushunqing
Copy link

I got same issue.
iMac 27 / 3.8 GHz 8-Core Intel Core i7 / AMD Radeon Pro 5500 XT 8 GB

@pkoszalkaa
Copy link

Same here
M1 Pro

@zy-meng
Copy link

zy-meng commented Dec 19, 2024

I got same issue.
ubuntu 20.04 / Intel(R) Xeon(R) Platinum 8358P CPU @ 2.60GHz / NVIDIA GTX 4090

@YutoYasunaga
Copy link

I tried both MacBook and Ubuntu, even Windows, but nothing works. So many errors, it keeps raising errors and other errors again and again.

@xiaoxubeii
Copy link

Same here, m1 pro

@eyalmentee
Copy link

same here, m4 pro

@Brief-rf
Copy link

same here, m2 air

@asapsav
Copy link

asapsav commented Dec 19, 2024

same, m2 pro

@sarmadgulzar
Copy link
Author

sarmadgulzar commented Dec 19, 2024

Works for me after:

  • Install ffmpeg using brew install ffmpeg
  • Upgrade PyOpenGL with pip install -U PyOpenGL
  • Remove pygel3d with pip uninstall pygel3d (that will get rid of the warnings you get when first launching)

This didn't work for me:

(venv) genesis-tests $ brew install ffmpeg
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################################## 100.0%
Warning: ffmpeg 7.1_3 is already installed and up-to-date.
To reinstall 7.1_3, run:
  brew reinstall ffmpeg
(venv) genesis-tests $ pip install PyOpenGL   
Requirement already satisfied: PyOpenGL in ./venv/lib/python3.10/site-packages (3.1.7)
(venv) genesis-tests $ pip uninstall pygel3d
Found existing installation: PyGEL3D 0.5.2
Uninstalling PyGEL3D-0.5.2:
  Would remove:
    /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/PyGEL3D-0.5.2.dist-info/*
    /Users/sarmad/Documents/Code/Python/genesis-tests/venv/lib/python3.10/site-packages/pygel3d/*
Proceed (Y/n)? 
  Successfully uninstalled PyGEL3D-0.5.2

@buck-0x
Copy link

buck-0x commented Dec 19, 2024

Same issue for me.

@vegito22
Copy link

I was facing a similar error, but managed to resolve it using conda (https://docs.anaconda.com/miniconda/install/#quick-command-line-install). The viewer loads for me

Device: Apple MacBook Pro
Processor: M1 Pro
RAM: 16GB
Python: 3.12.8

@soumith
Copy link

soumith commented Dec 20, 2024

this was quite a rabbit-hole, but basically what I found is that on a second "on_draw" of the pyrenderer viewer, the GL context is already in a bad state (from the first draw). What sets it into a bad state is self.jit.update(scene) in the renderer.

My speculation is that the JIT renderer isn't written to OpenGL compliance, or MacOS + Python (via uv) by default ships a crappy and incompliant OpenGL (or badly compiled taichi). Unclear which.

@YutoYasunaga
Copy link

Confirmed it works by using Conda for environment management. The viewer has rendered for me.
Thank @vegito22

Screenshot 2024-12-20 at 11 51 57

@CommanderCrowCode
Copy link

Confirmed it works by using Conda for environment management. The viewer has rendered for me. Thank @vegito22

Screenshot 2024-12-20 at 11 51 57

Second confirmation that Conda-managed environment works
image

@xiaoxubeii
Copy link

Me to, can run under conda.
image

@vinny-888
Copy link

What python version are you using in conda?

Python 3.11 is not working for me and still get this error

OpenGL.error.GLError: GLError(
	err = 1282,
	description = b'invalid operation',
	baseOperation = glBindFramebuffer,
	cArguments = (GL_DRAW_FRAMEBUFFER, 0)
)

@xiaoxubeii
Copy link

What python version are you using in conda?

Python 3.11 is not working for me and still get this error

OpenGL.error.GLError: GLError(
	err = 1282,
	description = b'invalid operation',
	baseOperation = glBindFramebuffer,
	cArguments = (GL_DRAW_FRAMEBUFFER, 0)
)

Python 3.12.8

@mgottscho
Copy link

Same errors. Confirming the miniconda suggestion also worked for me.

M3 Pro
36 GB
MacOS 15.2 (24C101)
python 3.12.8

@Ponkux
Copy link

Ponkux commented Dec 20, 2024

Same errors.
Apple M1
16GB
MacOS 15.2 (24C101)
python 3.12.6

@apandy02
Copy link

or MacOS + Python (via uv) by default ships a crappy and incompliant OpenGL (or badly compiled taichi)

@soumith I think the above makes sense. I went down the rabbit hole trying to get it to work in several differently configured uv environments with no success. one shotted it with conda + the above suggestions

@emalihin
Copy link

emalihin commented Dec 20, 2024

I was facing a similar error, but managed to resolve it using conda (https://docs.anaconda.com/miniconda/install/#quick-command-line-install). The viewer loads for me

Device: Apple MacBook Pro Processor: M1 Pro RAM: 16GB Python: 3.12.8

how did you install genesis-world with conda?

@soumith
Copy link

soumith commented Dec 20, 2024

can confirm, it works with conda.

Install conda on Mac M series via:

curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o miniconda.sh
bash miniconda.sh -b -u -p miniconda # installs to current folder in a `miniconda` subfolder
. miniconda/bin/activate

@emalihin after installing conda, I did:

conda create -n genesis python=3.12
conda activate genesis
pip install genesis-world
pip install torch

@Tuxliri
Copy link

Tuxliri commented Dec 20, 2024

I reproduced @soumith instructions and the render_on_macos.py works correctly.

@PieterBecking
Copy link
Contributor

Thank you @soumith .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests