google-deepmind / google-deepmind/mujoco

Rendering with OpenGL fails with "ARB_framebuffer_object required"

Open
#1,778 5 comments 0 reactions 0 assignees View on GitHub
maybe bug question
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

Hi,

I'm a student in research and I'm trying to use MuJoCo for simulating soft body touch and rendering haptic feedback, all of this in Virtual Reality.

I'm looking for some help with the render pipeline using OpenGL.

To integrate the virtual headsets in MuJoCo, I am trying to use the pyopenxr library. It uses glfw under the hood.
What is actively driving me nuts is this error when instantiating the MjrContext:
```
context = mujoco.MjrContext(model, mujoco.mjtFontScale.mjFONTSCALE_100)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mujoco.FatalError: OpenGL ARB_framebuffer_object required
```

Here is the related code:
```py
if not glfw.init():
raise RuntimeError("GLFW initialization failed")
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 4)
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 5)
window = glfw.create_window(1000, 600, "gl_example", None, None)
if window is None:
raise RuntimeError("Failed to create GLFW window")
glfw.make_context_current(window)

context = mujoco.MjrContext(model, mujoco.mjtFontScale.mjFONTSCALE_100)
```

What is really weird is that I tried this piece of code to check if the context indeed misses the `GL_ARB_framebuffer_object` extension:
```py
print("GL_ARB_framebuffer_object supported:", glfw.extension_supported("GL_ARB_framebuffer_object"))
# ...prints "1"
```
... and no, the context _has_ the extension. I do not understand why MuJoCo complains.

What is even weirder is that if I remove the two glfw window hints about the context version, the error disappears and everything works fine. The problem is I need those hints for OpenXR. What should I do?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.